[LLVMdev] Using CallingConvLower in ARM target

Dan Gohman gohman at apple.com
Sat Jan 3 11:46:55 PST 2009


On Dec 27, 2008, at 4:30 AM, Sandeep Patel wrote:

> Attached is a prototype patch that uses CCState to lower RET nodes in
> the ARM target. Lowering CALL nodes will come later.
>
> This patch does not handle f64 and i64 types. For these types, it
> would be ideal to request the conversions below:

i64 isn't Legal on ARM, so it should already be handled.

>
>
> def RetCC_ARM_APCS : CallingConv<[
>  CCIfType<[f32], CCBitConvertToType<i32>>,
>  CCIfType<[f64], CCBitConvertToType<i64>>,
>  CCIfType<[i64], CCExtractElements<2, i32>>,
>
>  CCIfType<[i32], CCAssignToReg<[R0, R1]>>
> ]>;
>
> The problem is that i64 handling requires splitting into 2 x i32
> registers. I am not sure how to build CCExtractElements as shown. The
> current organization of CCState::AnalyzeReturn does not allow for
> reissuing of the RET with an altered set of operands which is the
> solution used elsewhere. Can anyone suggest a better way to express
> this lowering?

One problem with this approach is that since i64 isn't legal, the
bitcast would require custom C++ code in the ARM target to
handle properly.  It might make sense to introduce something
like

    CCIfType<[f64], CCCustom>

where CCCustom is a new entity that tells the calling convention
code to to let the target do something not easily representable
in the tablegen minilanguage.

Dan




More information about the llvm-dev mailing list