[LLVMdev] Fixing VAARG on PPC64

Ivan Llopard ivanllopard at gmail.com
Fri Mar 23 01:50:12 PDT 2012


Hi Finkel,

Le 23/03/2012 05:50, Hal Finkel a écrit :
> The PowerPC backend on PPC64 for non-Darwin (SVR4 ABI) systems
> currently has a problem handling integer types smaller than 64 bits.
> This is because the ABI specifies that these types are zero-extended to
> 64 bits on the stack and the default logic provided in LegalizeDAG does
> not use that convention. Specifically, for these targets we have:
>        setOperationAction(ISD::VAARG, MVT::Other, Expand);
> I thought that I could solve this problem by:
>        setOperationAction(ISD::VAARG, MVT::i1, Promote);
>        AddPromotedToType (ISD::VAARG, MVT::i1, MVT::i64);
>        setOperationAction(ISD::VAARG, MVT::i8, Promote);
>        AddPromotedToType (ISD::VAARG, MVT::i8, MVT::i64);
>        setOperationAction(ISD::VAARG, MVT::i16, Promote);
>        AddPromotedToType (ISD::VAARG, MVT::i16, MVT::i64);
>        setOperationAction(ISD::VAARG, MVT::i32, Promote);
>        AddPromotedToType (ISD::VAARG, MVT::i32, MVT::i64);
> but this does not seem to have any effect. I thought this would work
> because SDValue DAGTypeLegalizer::PromoteIntRes_VAARG seems to have the
> appropriate logic. Is this a bug, or am I misunderstanding how Promote
> works?

IMHO, you are doing it right but it looks like ISD::VAARG is not handled 
in SelectionDAGLegalize::PromoteNode() yet. DAGTypeLegalizer is used to 
legalize "non-legal" types regardless of the operation (need confirmation).

Ivan

>
> Thanks again,
> Hal
>



More information about the llvm-dev mailing list