[LLVMdev] A question about Greedy Register Allocator's reload instruction.

Arsen Hakobyan artinetstudio at gmail.com
Tue Feb 17 05:17:57 PST 2015


Seems I am in a similar situation (if I don't misunderstood the question,
otherwise I will create a separate thread)

I got the following assembly code where I assume that stack adjustment was
done incorrectly:

.proc_beg func    
func:
.stack  1
// BB#0:                                // %entry
add  %sp, $-1, %sp
mov $0, 0[%sp]
...
rtnsr
add  %sp, $1, %sp
.proc_end func

.proc_beg main
main:
.stack_init %sp
.stack  3
// BB#0:                                // %entry
add  %sp, $-3, %sp
mov $32, 1[%sp]
mov $23, 0[%sp]
mov 1[%sp], %R0
mov 0[%sp], %R1
jmp func
mov %R0, g1
mov 1[%sp], %R0
jmp func
mov 0[%sp], %R1    ////<<< Here I assume that the 0[%sp] has been changed
during the first call of func. that is why an incorrect value is passed as
the parameter.
mov g1, %R1
mov %R0, g2
// printing %R1
// printing %R0


So I am not sure where to look for the issue. I am thinking that it could be
just an optimization issue after the correct register allocation or stack
adjustment, or may be this is connected with Pseudo hook instructions
ADJCALLSTACKDOWN and ADJCALLSTACKUP  :?

I am using an -O3 optimization level.

I would greatly appreciate any suggestion where to look for the issue.

Thanks,
Arsen



--
View this message in context: http://llvm.1065342.n5.nabble.com/A-question-about-Greedy-Register-Allocator-s-reload-instruction-tp63488p77953.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list