This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inline assembly syntax
- From: <tm_gccmail at kloo dot net>
- To: Ian Lance Taylor <ian at wasabisystems dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 10 May 2004 17:37:47 -0700 (PDT)
- Subject: Re: Inline assembly syntax
On 7 May 2004, Ian Lance Taylor wrote:
> These lead us in the direction of
>
> asm
> {
> 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
> }
>
> Hmmm.
>
> Ian
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.
Toshi