[LLVMdev] Fixing VAARG on PPC64

Hal Finkel hfinkel at anl.gov
Thu Mar 22 21:50:36 PDT 2012


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?

Thanks again,
Hal

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list