This is the mail archive of the 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: Inline assembly syntax wrote:

On 7 May 2004, Ian Lance Taylor wrote:

These lead us in the direction of

   add r0, foo, bar    // register r0 = variable foo + variable bar
   add r0, "r1", r2    // register r0 = variable r1 + register r2
   {                   // instructions in block may not be rearranged
     cli               // disable interrupts
     add 0(r0), 1      // * (register r0) += 1
     sti               // enable interuppts
   svc 21 __clobber__(r0,r1,r2) // supervisor call
   __noschedule__      // scheduling barrier
   addi r0, r1, constant __constraint__(i) // specify constraint



I can see large problems with this. You wind up needing to scan the assembly block twice: once to determine the register constraints, and once to actually process the code.

For example, on the SH there's an instruction:

mov.l @(r0,rm),rn

where the index register must be r0.

If the user tries to use two different variables for the index register:

	mov.l	@("index1","base1"),var1
	mov.l	@("index2","base2"),var2

then you wind up with the compiler crashing later on because you're trying
to use two different variables in r0, or else you have to do reloads.


Metrowerks did port to the SH once upon a time, so presumably they at
least had to think about it at some point. Doesn't look to be a
currently supported target, but it was hard to tell for sure from
their website; the material there seems be for SH Linux, and they're
likely using GCC for that activity.


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