[LLVMdev] What CCAssignToXXXWithShadow means?
anton at korobeynikov.info
Fri Sep 23 04:16:06 PDT 2011
> I don't know when we should use CCAssignToRegWithShadow. Because
> I am not a architecture expert, please bear with my naive question.
> Take ARMCallingConv.td as an example,
ARM is not good example :) Look into win64 calling convention. Shadow
means if some register is allocated for incoming argument another one
cannot be used for argument allocation.
On Win64 general purpose registers shadow xmm and vice versa, so, say,
if you put argument into ecx, the xmm0 is marked as already occupied,
if you put argument into xmm1, edx is marked as occupied, etc.
> CCIfType<[i32], CCIfAlign<"8", CCAssignToRegWithShadow<[R0, R2], [R0, R1]>>>
> If we assign a value to R0(R2), then what happen to R0(R1)?
It will be marked as occupied.
> def RetCC_ARM_AAPCS_Common : CallingConv<[
> CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>,
> CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>>
> Does it mean the samething as above?
Yes. On ARM shadowing used as a trick to ensure "register alignment"
for i64 arguments - they should always be allocated starting from
even-numbered register and remaining (odd-numbered) one should be left
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
More information about the llvm-dev