This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Revised patch to remove integer output macros


On Fri, Dec 14, 2001 at 11:46:16PM +0000, Richard Sandiford wrote:
> The patch adds a string hook for bytes and separate aligned and
> unaligned hooks for HI-, SI-, DI- and TI-sized integers.  These strings
> will be NULL for unsupported directives.  The patch also adds a more
> general function for cases where the string hook is NULL.

In general, this looks really good.  The only real mistake I think
is that you should _always_ call the hook first, and that if the
target does support a simple string for emitting data, then it 
should be present.  I.e.

   bool
   default_assemble_integer (x, size, aligned_p)
        rtx x;
        unsigned int size;
        int aligned_p;
   {
     const char *op = integer_asm_op (size, aligned_p);
     if (op)
       {
         assemble_integer_with_op (op, x);
         return true;
       }
     return false;
   }
   
   bool
   assemble_integer (x, size, align, force)
        rtx x;
        unsigned int size;
        unsigned int align;
        int force;
   {
     int aligned_p = (align >= MIN (size * BITS_PER_UNIT, BIGGEST_ALIGNMENT));
     
     if ((*targetm.asm_out.integer) (x, size, aligned_p))
       return true;
   
     ...
   }  

For instance, that would let ARC do 

   static bool
   arc_assemble_integer (x, size, aligned_p)
        rtx x;
        unsigned int size;
        int aligned_p;
   {
     if (size == UNITS_PER_WORD && aligned_p
         && ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FLAG (x))
	     || GET_CODE (x) == LABEL_REF))
       {
         fputs ("\t.word\t%st(", asm_out_file);
         output_addr_const (asm_out_file, x);
         fputs (")\n", asm_out_file);
         return true;
       }
   
     return default_assemble_integer (x, size, aligned_p);  
   }

This would clean up quite a lot of the tricky bits that you
encountered, particularly on rs6000.

I'll look through the rest of the patch in detail in a bit.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]