Use new SDIselParamAttr enumeration. This removes "magick" constants
authorAnton Korobeynikov <asl@math.spbu.ru>
Tue, 6 Mar 2007 08:12:33 +0000 (08:12 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Tue, 6 Mar 2007 08:12:33 +0000 (08:12 +0000)
from formal attributes' flags processing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34963 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp
lib/Target/TargetCallingConv.td
lib/Target/X86/X86ISelLowering.cpp
utils/TableGen/CallingConvEmitter.cpp

index f573198bae212509012f6a73ad473fbb9d60b436..88c6ad01d11949ec9d20c5bd4d2b23cd2b273cbd 100644 (file)
@@ -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;
index edcd6dd70e87cb942b6d62ac1532a93fbba0bd35..3f71a1de2b04f3e8dfe79dd10eb00a5106eb862f 100644 (file)
@@ -38,7 +38,7 @@ class CCIfCC<string CC, CCAction A>
 
 /// CCIfInReg - If this argument is marked with the 'inreg' attribute, apply
 /// the specified action.
-class CCIfInReg<CCAction A> : CCIf<"ArgFlags & 2", A> {}
+class CCIfInReg<CCAction A> : CCIf<"ArgFlags & SDISelParamFlags::InReg", A> {}
 
 
 /// CCAssignToReg - This action matches if there is a register in the specified
index c0c7b79132afbe3ec10ba08c85ada67ce00e0b2f..5502cdca035b6389b97664721f19fce19f60b6f1 100644 (file)
@@ -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<ConstantSDNode>(Op.getOperand(3))->getValue() & 4))
+    if (NumArgs &&
+        (cast<ConstantSDNode>(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<ConstantSDNode>(Op.getOperand(6))->getValue()&4);
+  bool isSRet = NumOps &&
+    (cast<ConstantSDNode>(Op.getOperand(6))->getValue() &
+     SDISelParamFlags::StructReturn);
   
   if (!MemOpChains.empty())
     Chain = DAG.getNode(ISD::TokenFactor, MVT::Other,
index b85d828f9d7c53f6ec8e30f59c236412b599239f..97eeeb352709283bead47eaeed2a7da29d0aa805 100644 (file)
@@ -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!";