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]

Re: volatile asm fix


  In message <19990409125504.B28210@cygnus.com>you write:
  > On Fri, Apr 09, 1999 at 01:21:05AM -0600, Jeffrey A Law wrote:
  > > +   /* A volatile ASM invalidates everything.  */
  > > +   if (GET_CODE (insn) == INSN
  > > +       && GET_CODE (PATTERN (insn)) == ASM_OPERANDS
  > > +       && MEM_VOLATILE_P (PATTERN (insn)))
  > > +     flush_hash_table ();
  > 
  > This can't be right.  Consider
  > 
  >   asm("1");
  >   asm volatile ("2" : "=r"(tmp));
  >   asm volatile ("3" : "=r"(tmp), "=r"(tmp2));
  >   asm volatile ("4" : : "r"(0));
  > 
  > We get patterns like
  > 
  > (insn 8 6 10 (asm_input ("1")) -1 (nil)
  >     (nil))
I think I missed this one.  It should be easy enough to handle.


  > (insn 10 8 12 (set (mem:SI (reg:DI 65))
  >         (asm_operands/v ("2") ("=r") 0[ ] 
  >             [ ]  ("z.c") 5)) -1 (nil)
  >     (nil))
Handled by canon_hash.  We don't put it into the hash table because
the ASM_OPERANDS has volatile set.


  > (insn 12 10 14 (parallel[ 
  >             (set (mem:SI (reg:DI 65))
  >                 (asm_operands/v ("3") ("=r") 0[ ] 
  >                     [ ]  ("z.c") 6))
  >             (set (mem:SI (plus:DI (reg:DI 65)
  >                         (const_int 4)))
  >                 (asm_operands/v ("3") ("=r") 1[ ] 
  >                     [ ]  ("z.c") 6))
  >         ] ) -1 (nil)
  >     (nil))
SImilarly.


  > (insn 14 12 16 (asm_operands/v ("4") ("") 0[ 
  >             (const_int 0)
  >         ] 
  >         [ 
  >             (asm_input:SI ("r"))
  >         ]  ("z.c") 7) -1 (nil)
  >     (nil))
  > 
  > Your patch only handles one of them, and not the old-style asm
  > as you said in other mail.
This is the one my patch handled.  Sorry, my brain must have been shutting
down last night.

asms suck.  Especially when we have a zillion different ways to represent
them.


So, I think we need to go back and make sure we handle ASM_INPUT correctly
in cse.  Then also check up on reload_cse.

jeff


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