[llvm-commits] [llvm] r44107 - in /llvm/trunk: lib/Target/TargetCallingConv.td lib/Target/X86/X86CallingConv.td utils/TableGen/CallingConvEmitter.cpp

Duncan Sands baldrick at free.fr
Wed Nov 14 00:29:13 PST 2007


Author: baldrick
Date: Wed Nov 14 02:29:13 2007
New Revision: 44107

URL: http://llvm.org/viewvc/llvm-project?rev=44107&view=rev
Log:
Eliminate the recently introduced CCAssignToStackABISizeAlign
in favour of teaching CCAssignToStack that size 0 and/or align
0 means to use the ABI values.  This seems a neater solution.
It is safe since no legal value type has size 0.

Modified:
    llvm/trunk/lib/Target/TargetCallingConv.td
    llvm/trunk/lib/Target/X86/X86CallingConv.td
    llvm/trunk/utils/TableGen/CallingConvEmitter.cpp

Modified: llvm/trunk/lib/Target/TargetCallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetCallingConv.td?rev=44107&r1=44106&r2=44107&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetCallingConv.td (original)
+++ llvm/trunk/lib/Target/TargetCallingConv.td Wed Nov 14 02:29:13 2007
@@ -60,19 +60,14 @@
 }
 
 /// CCAssignToStack - This action always matches: it assigns the value to a
-/// stack slot of the specified size and alignment on the stack.
+/// stack slot of the specified size and alignment on the stack.  If size is
+/// zero then the ABI size is used; if align is zero then the ABI alignment
+/// is used - these may depend on the target or subtarget.
 class CCAssignToStack<int size, int align> : CCAction {
   int Size = size;
   int Align = align;
 }
 
-/// CCAssignToStackABISizeAlign - This action always matches: it assigns
-/// the value to a stack slot of the ABISize and ABIAlignment for the type,
-/// which may depend on the target or subtarget.
-/// "ignored" is here because an empty arg list does not work.
-class CCAssignToStackABISizeAlign<int ignored> : CCAction {
-}
-
 /// CCStructAssign - This action always matches: it will use the C ABI and
 /// the register availability to decided whether to assign to a set of
 /// registers or to a stack slot.

Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=44107&r1=44106&r2=44107&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Wed Nov 14 02:29:13 2007
@@ -120,7 +120,7 @@
   
   // Long doubles get stack slots whose size and alignment depends on the
   // subtarget.
-  CCIfType<[f80], CCAssignToStackABISizeAlign<0>>,
+  CCIfType<[f80], CCAssignToStack<0, 0>>,
 
   // Vectors get 16-byte stack slots that are 16-byte aligned.
   CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack<16, 16>>,
@@ -181,7 +181,7 @@
 
   // Long doubles get slots whose size and alignment depends on the
   // subtarget.
-  CCIfType<[f80], CCAssignToStackABISizeAlign<0>>,
+  CCIfType<[f80], CCAssignToStack<0, 0>>,
 
   // The first 4 vector arguments are passed in XMM registers.
   CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],

Modified: llvm/trunk/utils/TableGen/CallingConvEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CallingConvEmitter.cpp?rev=44107&r1=44106&r2=44107&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CallingConvEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/CallingConvEmitter.cpp Wed Nov 14 02:29:13 2007
@@ -114,19 +114,21 @@
     } else if (Action->isSubClassOf("CCAssignToStack")) {
       int Size = Action->getValueAsInt("Size");
       int Align = Action->getValueAsInt("Align");
-      
+
       O << IndentStr << "unsigned Offset" << ++Counter
-        << " = State.AllocateStack(" << Size << ", " << Align << ");\n";
-      O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
-        << Counter << ", LocVT, LocInfo));\n";
-      O << IndentStr << "return false;\n";
-    } else if (Action->isSubClassOf("CCAssignToStackABISizeAlign")) {
-      O << IndentStr << "unsigned Offset" << ++Counter
-        << " = State.AllocateStack(State.getTarget().getTargetData()"
-           "->getABITypeSize(MVT::getTypeForValueType(LocVT)),\n";
-      O << IndentStr << "       State.getTarget().getTargetData()"
-           "->getABITypeAlignment(MVT::getTypeForValueType(LocVT)));\n";
-      O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
+        << " = State.AllocateStack(";
+      if (Size)
+        O << Size << ", ";
+      else
+        O << "\n" << IndentStr << "  State.getTarget().getTargetData()"
+          "->getABITypeSize(MVT::getTypeForValueType(LocVT)), ";
+      if (Align)
+        O << Align;
+      else
+        O << "\n" << IndentStr << "  State.getTarget().getTargetData()"
+          "->getABITypeAlignment(MVT::getTypeForValueType(LocVT))";
+      O << ");\n" << IndentStr
+        << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
         << Counter << ", LocVT, LocInfo));\n";
       O << IndentStr << "return false;\n";
     } else if (Action->isSubClassOf("CCPromoteToType")) {





More information about the llvm-commits mailing list