confused by 990130-1.c
Richard Henderson
rth@cygnus.com
Wed Mar 31 23:46:00 GMT 1999
On Mon, Mar 01, 1999 at 11:17:57PM -0500, Zack Weinberg wrote:
> void foo (void)
> {
> asm ("# %0" : "+r" (*bar()));
> }
[...]
> test.c: In function `foo':
> test.c:5: output number 0 not restored to memory
[...]
> (insn 12 11 0 (set (mem:SI (reg:SI 22) 1)
> (asm_operands ("# %0") ("=r") 0[
> (mem:SI (reg:SI 22) 1)
> ]
> [
> (asm_input:SI ("0"))
> ] ("test.c") 5)) -1 (insn_list 11 (nil))
> (expr_list:REG_DEAD (reg:SI 22)
> (nil)))
The problem is that the code in question is trying to reduce the
work for reload. Doing so greatly increases the chances that we'll
not run out of reload registers trying to process the asm. Thus
that example would best generate the rtl
(set (reg:SI tmp) (mem:SI (reg:SI 22)))
(set (reg:SI tmp)
(asm_operands ("# %0") ("=r") 0[
(reg:SI tmp)
]
[
(asm_input:SI ("0"))
] ("test.c") 5))
(set (mem:SI (reg:SI 22)) (reg:SI tmp))
since "+r" wants a register not a memory. But that was trickier than
I wanted to tackle at the time so I printed the warning and bailed; I'm
marginally surprised that it does do the right thing. I added the test
to remind me to revisit the problem.
r~
More information about the Gcc
mailing list