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]

Register-passed arguments copied to the stack?

Hello everybody,

I've changed my virtual target so it passes arguments into registers instead 
of the stack, to make them easier to handle. Both caller and callee see the 
arguments in the same hard registers, which are reserved exclusively for this 

But the callee makes something weird: at the beginning of the function, it 
copies all the arguments it received on the stack instead of directly using 
the register arguments. In the sample below, a short is passed through 
register 4 and a byte is passed through register 5. register 1 is the frame 
pointer. The prototype of the function is void func(short arg1, char arg2), 
and here is the RTL dump of the beginning of the function after the reloading 

(note 16 2 3 0 [bb 0] NOTE_INSN_BASIC_BLOCK)

(insn 3 16 4 0 (set (mem/f:HI (reg/f:SI 1 (null)) [0 arg1+0 S2 A8])
        (reg:HI 4 (null) [ arg1 ])) 5 {*mov_all_modes} (nil)

(insn 4 3 5 0 (set (mem/f:QI (plus:SI (reg/f:SI 1 (null))
                (const_int 2 [0x2])) [0 arg2+0 S1 A8])
        (reg:QI 5 (null) [ arg2 ])) 5 {*mov_all_modes} (nil)

(note 5 4 10 0 NOTE_INSN_FUNCTION_BEG)

Right after that, registers 4 and 5 are no more used and references from the 
frame pointer are used instead. This is not what I want: instead, I'd like 
the argument registers to be used, from the beginning to the end.

Note that this behavior is already visible right after RTL generation and 
can't come from the reloading.

Any hint on what could cause this behavior?

Unrelated: is there a way to easily retrieve the extra information that is 
visible in the RTL dumps for every rtx from the backend? (i.e. the stuff in 
brackets: [0 arg1+0 S2 A8]) This gives precious information on what kind of 
operand is manipulated, and although I manage to know it by making my own 
mapping from the source tree, this seems to be much better suited.

Thanks in advance,

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