Question about calling convention implementation in LLVM target

Hi,

We are currently developing an LLVM target for a micro-controller,
and would like our TargetLowering::LowerCall method to emit
PUSH instructions (instead of STORE) to pass arguments (which
would improve code density for function calls).

Is there a way of keeping track of the stack pointer changes
implied by the PUSH instruction to calculate the correct
offsets in RegisterInfo::eliminateFrameIndex when the call
sequence is generated ?

Thanks a lot in advance,
Rod

To my knowledge, this is an open project. It would also really help with x86_32 codegen, but people care less and less about that as time goes on.

In theory, the SPAdj (stack pointer adjustment) tracking in PEI could be used to support something like this. That’s not how it’s used right now and it might get more than a little interesting implementing that, though.

-Jim

Also, push and pop operations are slower on some architectures (I believe the x86_32 is one of them). Smaller instructions are not always faster.

Hi,

Thanks for your answers.

In theory, the SPAdj (stack pointer adjustment) tracking in PEI

> could be used to support something like this. That’s not how it’s

used right now and it might get more than a little interesting
implementing that, though.

We didn't manage to get this working and decided to use offsets
relative to the frame pointer (instead of stack pointer) so PUSH
instructions don't affect them.

Also, push and pop operations are slower on some architectures (I
believe the x86_32 is one of them). Smaller instructions are not
always faster.

Code density (which is as important as speed for us) will be better
and speed will approximately be the same (might be a bit slower in
some specific cases).

Rod