This is the mail archive of the gcc-bugs@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: Bug in haifa scheduler ?



  In message <Pine.HPP.3.96.980627022254.29572D-100000@gra-ux1.iram.es>you write:
  > > But without the "memory" in the asm the compiler doesn't know that the
  > > changes memory and thus the compiler decides it is safe (for example)
  > > to hold a value that was loaded from memory in a register across the
  > > asm statement.
  > 
  > That's exactly what I want (unless there is a misunderstanding somewhere). 
  > Most I/O instructions do not have side effect on variables (local and
  > global) kept in registers, they simply should be treated as an access to
  > volatile memory.
Sorry.  I should have looked at the indention a little closer and realized
I was replying to someone else's comment, not yours.


  > - for inw:
  > 	asm("lhbrx %0,0,%1" : "=r" (data): "r" (port), "m" (*port));
  > 
  > - for outw:
  > 	asm("sthbrx %1,0,%2" : "=m" (*port): "r" (data), "r" (port));
  > 
  > in both cases one the parameter wit the "m" constraint is not used in the
  > asm statement but it should not matter.
Right.  The compiler doesn't care about the contents of the assembly
template, it only cares about the output, input, clobber lists.

  > parameters not being used. Furthermore, it should not allocate any
  > additional registers for the "m" constraint given the "r" (port) 
  > constraint.
I believe that is correct.

  > Essentially the "m" constraint means that we are accessing
  > volatile memory, the other ones describe how it is implemented. 
How does the compiler know you're referencing volatile memory?  Other
than that I think you're OK.

jeff


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