[llvm-commits] CVS: llvm/utils/TableGen/CallingConvEmitter.cpp

Chris Lattner sabre at nondot.org
Tue Feb 27 20:44:05 PST 2007



Changes in directory llvm/utils/TableGen:

CallingConvEmitter.cpp updated: 1.2 -> 1.3
---
Log message:

implement CCPromoteToType


---
Diffs of the changes:  (+13 -8)

 CallingConvEmitter.cpp |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)


Index: llvm/utils/TableGen/CallingConvEmitter.cpp
diff -u llvm/utils/TableGen/CallingConvEmitter.cpp:1.2 llvm/utils/TableGen/CallingConvEmitter.cpp:1.3
--- llvm/utils/TableGen/CallingConvEmitter.cpp:1.2	Tue Feb 27 16:08:27 2007
+++ llvm/utils/TableGen/CallingConvEmitter.cpp	Tue Feb 27 22:43:48 2007
@@ -26,9 +26,11 @@
   // other.
   for (unsigned i = 0, e = CCs.size(); i != e; ++i) {
     O << "static bool " << CCs[i]->getName()
-      << "(unsigned ValNo, MVT::ValueType ValVT, MVT::ValueType LocVT,\n"
+      << "(unsigned ValNo, MVT::ValueType ValVT,\n"
       << std::string(CCs[i]->getName().size()+13, ' ')
-      << "CCValAssign::LocInfo LocInfo, unsigned ArgFlags, CCState &State);\n";
+      << "MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,\n"
+      << std::string(CCs[i]->getName().size()+13, ' ')
+      << "unsigned ArgFlags, CCState &State);\n";
   }
   
   // Emit each calling convention description in full.
@@ -42,11 +44,11 @@
   Counter = 0;
 
   O << "\n\nstatic bool " << CC->getName()
-    << "(unsigned ValNo, MVT::ValueType ValVT, MVT::ValueType LocVT,\n"
+    << "(unsigned ValNo, MVT::ValueType ValVT,\n"
+    << std::string(CC->getName().size()+13, ' ')
+    << "MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,\n"
     << std::string(CC->getName().size()+13, ' ')
-    << "CCValAssign::LocInfo LocInfo, "
     << "unsigned ArgFlags, CCState &State) {\n";
-      
   // Emit all of the actions, in order.
   for (unsigned i = 0, e = CCActions->getSize(); i != e; ++i) {
     O << "\n";
@@ -68,7 +70,7 @@
       ListInit *VTs = Action->getValueAsListInit("VTs");
       for (unsigned i = 0, e = VTs->getSize(); i != e; ++i) {
         Record *VT = VTs->getElementAsRecord(i);
-        if (i != 0) O << " || \n    " << IndentStr;
+        if (i != 0) O << " ||\n    " << IndentStr;
         O << "LocVT == " << getEnumName(getValueType(VT));
       }
 
@@ -115,11 +117,14 @@
       
       O << IndentStr << "unsigned Offset" << ++Counter
         << " = State.AllocateStack(" << Size << ", " << Align << ");\n";
-      O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ArgVT, Offset"
+      O << IndentStr << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
         << Counter << ", LocVT, LocInfo));\n";
       O << IndentStr << "return false;\n";
     } 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";
     } else {
       Action->dump();
       throw "Unknown CCAction!";






More information about the llvm-commits mailing list