From e7ec3bc7bca308e1620916ac2d6d27463d062aa0 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Tue, 6 Mar 2007 08:12:33 +0000 Subject: [PATCH] Use new SDIselParamAttr enumeration. This removes "magick" constants from formal attributes' flags processing. llvm-svn: 34963 --- llvm/lib/Target/ARM/ARMISelLowering.cpp | 3 ++- llvm/lib/Target/TargetCallingConv.td | 2 +- llvm/lib/Target/X86/X86ISelLowering.cpp | 11 ++++++++--- llvm/utils/TableGen/CallingConvEmitter.cpp | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index f573198bae21..88c6ad01d119 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -27,6 +27,7 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/SSARegMap.h" #include "llvm/Target/TargetOptions.h" #include "llvm/ADT/VectorExtras.h" @@ -346,7 +347,7 @@ HowToPassArgument(MVT::ValueType ObjectVT, unsigned NumGPRs, NeededGPRs = 0; StackPad = 0; GPRPad = 0; - unsigned align = (Flags >> 27); + unsigned align = (Flags >> SDISelParamFlags::OrigAlignmentOffs); GPRPad = NumGPRs % ((align + 3)/4); StackPad = StackOffset % align; unsigned firstGPR = NumGPRs + GPRPad; diff --git a/llvm/lib/Target/TargetCallingConv.td b/llvm/lib/Target/TargetCallingConv.td index edcd6dd70e87..3f71a1de2b04 100644 --- a/llvm/lib/Target/TargetCallingConv.td +++ b/llvm/lib/Target/TargetCallingConv.td @@ -38,7 +38,7 @@ class CCIfCC /// CCIfInReg - If this argument is marked with the 'inreg' attribute, apply /// the specified action. -class CCIfInReg : CCIf<"ArgFlags & 2", A> {} +class CCIfInReg : CCIf<"ArgFlags & SDISelParamFlags::InReg", A> {} /// CCAssignToReg - This action matches if there is a register in the specified diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index c0c7b79132af..5502cdca035b 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -29,6 +29,7 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/SSARegMap.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetOptions.h" @@ -665,10 +666,12 @@ SDOperand X86TargetLowering::LowerCCCArguments(SDOperand Op, SelectionDAG &DAG, BytesToPopOnReturn = StackSize; // Callee pops everything.. BytesCallerReserves = 0; } else { - BytesToPopOnReturn = 0; // Callee pops hidden struct pointer. + BytesToPopOnReturn = 0; // Callee pops nothing. // If this is an sret function, the return should pop the hidden pointer. - if (NumArgs && (cast(Op.getOperand(3))->getValue() & 4)) + if (NumArgs && + (cast(Op.getOperand(3))->getValue() & + SDISelParamFlags::StructReturn)) BytesToPopOnReturn = 4; BytesCallerReserves = StackSize; @@ -740,7 +743,9 @@ SDOperand X86TargetLowering::LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, } // If the first argument is an sret pointer, remember it. - bool isSRet = NumOps &&(cast(Op.getOperand(6))->getValue()&4); + bool isSRet = NumOps && + (cast(Op.getOperand(6))->getValue() & + SDISelParamFlags::StructReturn); if (!MemOpChains.empty()) Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, diff --git a/llvm/utils/TableGen/CallingConvEmitter.cpp b/llvm/utils/TableGen/CallingConvEmitter.cpp index b85d828f9d7c..97eeeb352709 100644 --- a/llvm/utils/TableGen/CallingConvEmitter.cpp +++ b/llvm/utils/TableGen/CallingConvEmitter.cpp @@ -123,8 +123,8 @@ void CallingConvEmitter::EmitAction(Record *Action, } else if (Action->isSubClassOf("CCPromoteToType")) { Record *DestTy = Action->getValueAsDef("DestTy"); O << IndentStr << "LocVT = " << getEnumName(getValueType(DestTy)) <<";\n"; - O << IndentStr << "LocInfo = (ArgFlags & 1) ? CCValAssign::SExt" - << " : CCValAssign::ZExt;\n"; + O << IndentStr << "LocInfo = (ArgFlags & SDISelParamFlags::Signed) ? \n" + << IndentStr << IndentStr << "CCValAssign::SExt : CCValAssign::ZExt;\n"; } else { Action->dump(); throw "Unknown CCAction!";