Increase ISD::ParamFlags to 64 bits. Increase the ByValSize
field to 32 bits, thus enabling correct handling of ByVal
structs bigger than 0x1ffff. Abstract interface a bit.
Fixes gcc.c-torture/execute/pr23135.c and
gcc.c-torture/execute/pr28982b.c in gcc testsuite (were ICE'ing
on ppc32, quietly producing wrong code on x86-32.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48122 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index 6b6ec55..ea7f25b 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -1361,8 +1361,10 @@
MVT::ValueType ObjectVT = Op.getValue(ArgNo).getValueType();
unsigned ObjSize = MVT::getSizeInBits(ObjectVT)/8;
unsigned ArgSize = ObjSize;
- unsigned Flags = cast<ConstantSDNode>(Op.getOperand(ArgNo+3))->getValue();
- unsigned AlignFlag = 1 << ISD::ParamFlags::OrigAlignmentOffs;
+ ISD::ParamFlags::ParamFlagsTy Flags =
+ cast<ConstantSDNode>(Op.getOperand(ArgNo+3))->getValue();
+ unsigned AlignFlag = ISD::ParamFlags::One
+ << ISD::ParamFlags::OrigAlignmentOffs;
unsigned isByVal = Flags & ISD::ParamFlags::ByVal;
// See if next argument requires stack alignment in ELF
bool Expand = (ObjectVT == MVT::f64) || ((ArgNo + 1 < e) &&
@@ -1659,8 +1661,9 @@
/// does not fit in registers.
static SDOperand
CreateCopyOfByValArgument(SDOperand Src, SDOperand Dst, SDOperand Chain,
- unsigned Flags, SelectionDAG &DAG, unsigned Size) {
- unsigned Align = 1 <<
+ ISD::ParamFlags::ParamFlagsTy Flags,
+ SelectionDAG &DAG, unsigned Size) {
+ unsigned Align = ISD::ParamFlags::One <<
((Flags & ISD::ParamFlags::ByValAlign) >> ISD::ParamFlags::ByValAlignOffs);
SDOperand AlignNode = DAG.getConstant(Align, MVT::i32);
SDOperand SizeNode = DAG.getConstant(Size, MVT::i32);
@@ -1693,7 +1696,8 @@
// Add up all the space actually used.
for (unsigned i = 0; i != NumOps; ++i) {
- unsigned Flags = cast<ConstantSDNode>(Op.getOperand(5+2*i+1))->getValue();
+ ISD::ParamFlags::ParamFlagsTy Flags =
+ cast<ConstantSDNode>(Op.getOperand(5+2*i+1))->getValue();
unsigned ArgSize =MVT::getSizeInBits(Op.getOperand(5+2*i).getValueType())/8;
if (Flags & ISD::ParamFlags::ByVal)
ArgSize = (Flags & ISD::ParamFlags::ByValSize) >>
@@ -1757,8 +1761,10 @@
for (unsigned i = 0; i != NumOps; ++i) {
bool inMem = false;
SDOperand Arg = Op.getOperand(5+2*i);
- unsigned Flags = cast<ConstantSDNode>(Op.getOperand(5+2*i+1))->getValue();
- unsigned AlignFlag = 1 << ISD::ParamFlags::OrigAlignmentOffs;
+ ISD::ParamFlags::ParamFlagsTy Flags =
+ cast<ConstantSDNode>(Op.getOperand(5+2*i+1))->getValue();
+ unsigned AlignFlag = ISD::ParamFlags::One <<
+ ISD::ParamFlags::OrigAlignmentOffs;
// See if next argument requires stack alignment in ELF
unsigned next = 5+2*(i+1)+1;
bool Expand = (Arg.getValueType() == MVT::f64) || ((i + 1 < NumOps) &&