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

Chris Lattner sabre at nondot.org
Tue Feb 27 14:08:44 PST 2007



Changes in directory llvm/utils/TableGen:

CallingConvEmitter.cpp updated: 1.1 -> 1.2
CodeGenTarget.cpp updated: 1.84 -> 1.85
Record.cpp updated: 1.57 -> 1.58
Record.h updated: 1.61 -> 1.62
TableGen.cpp updated: 1.49 -> 1.50
---
Log message:

reapply


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

 CallingConvEmitter.cpp |    3 ++-
 CodeGenTarget.cpp      |    8 ++------
 Record.cpp             |    7 +++++++
 Record.h               |    2 ++
 TableGen.cpp           |    8 +++++++-
 5 files changed, 20 insertions(+), 8 deletions(-)


Index: llvm/utils/TableGen/CallingConvEmitter.cpp
diff -u llvm/utils/TableGen/CallingConvEmitter.cpp:1.1 llvm/utils/TableGen/CallingConvEmitter.cpp:1.2
--- llvm/utils/TableGen/CallingConvEmitter.cpp:1.1	Tue Feb 27 16:05:51 2007
+++ llvm/utils/TableGen/CallingConvEmitter.cpp	Tue Feb 27 16:08:27 2007
@@ -125,4 +125,5 @@
       throw "Unknown CCAction!";
     }
   }
-}
\ No newline at end of file
+}
+


Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.84 llvm/utils/TableGen/CodeGenTarget.cpp:1.85
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.84	Tue Feb 27 15:44:08 2007
+++ llvm/utils/TableGen/CodeGenTarget.cpp	Tue Feb 27 16:08:27 2007
@@ -604,9 +604,7 @@
   // Parse the list of argument types.
   ListInit *TypeList = R->getValueAsListInit("Types");
   for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) {
-    DefInit *DI = dynamic_cast<DefInit*>(TypeList->getElement(i));
-    assert(DI && "Invalid list type!");
-    Record *TyEl = DI->getDef();
+    Record *TyEl = TypeList->getElementAsRecord(i);
     assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
     ArgTypes.push_back(TyEl->getValueAsString("TypeVal"));
     
@@ -620,9 +618,7 @@
   // Parse the intrinsic properties.
   ListInit *PropList = R->getValueAsListInit("Properties");
   for (unsigned i = 0, e = PropList->getSize(); i != e; ++i) {
-    DefInit *DI = dynamic_cast<DefInit*>(PropList->getElement(i));
-    assert(DI && "Invalid list type!");
-    Record *Property = DI->getDef();
+    Record *Property = PropList->getElementAsRecord(i);
     assert(Property->isSubClassOf("IntrinsicProperty") &&
            "Expected a property!");
     


Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.57 llvm/utils/TableGen/Record.cpp:1.58
--- llvm/utils/TableGen/Record.cpp:1.57	Tue Feb 27 15:44:08 2007
+++ llvm/utils/TableGen/Record.cpp	Tue Feb 27 16:08:27 2007
@@ -337,6 +337,13 @@
   return new ListInit(Vals);
 }
 
+Record *ListInit::getElementAsRecord(unsigned i) const {
+  assert(i < Values.size() && "List element index out of range!");
+  DefInit *DI = dynamic_cast<DefInit*>(Values[i]);
+  if (DI == 0) throw "Expected record in list!";
+  return DI->getDef();
+}
+
 Init *ListInit::resolveReferences(Record &R, const RecordVal *RV) {
   std::vector<Init*> Resolved;
   Resolved.reserve(getSize());


Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.61 llvm/utils/TableGen/Record.h:1.62
--- llvm/utils/TableGen/Record.h:1.61	Tue Feb 27 15:44:08 2007
+++ llvm/utils/TableGen/Record.h	Tue Feb 27 16:08:27 2007
@@ -626,6 +626,8 @@
     return Values[i];
   }
 
+  Record *getElementAsRecord(unsigned i) const;
+  
   Init *convertInitListSlice(const std::vector<unsigned> &Elements);
 
   virtual Init *convertInitializerTo(RecTy *Ty) {


Index: llvm/utils/TableGen/TableGen.cpp
diff -u llvm/utils/TableGen/TableGen.cpp:1.49 llvm/utils/TableGen/TableGen.cpp:1.50
--- llvm/utils/TableGen/TableGen.cpp:1.49	Tue Feb 27 15:44:08 2007
+++ llvm/utils/TableGen/TableGen.cpp	Tue Feb 27 16:08:27 2007
@@ -20,6 +20,7 @@
 #include "llvm/Support/Streams.h"
 #include "llvm/System/Signals.h"
 #include "llvm/Support/FileUtilities.h"
+#include "CallingConvEmitter.h"
 #include "CodeEmitterGen.h"
 #include "RegisterInfoEmitter.h"
 #include "InstrInfoEmitter.h"
@@ -38,6 +39,7 @@
   GenEmitter,
   GenRegisterEnums, GenRegister, GenRegisterHeader,
   GenInstrEnums, GenInstrs, GenAsmWriter, 
+  GenCallingConv,
   GenDAGISel,
   GenSubtarget,
   GenIntrinsic,
@@ -61,6 +63,8 @@
                                "Generate enum values for instructions"),
                     clEnumValN(GenInstrs, "gen-instr-desc",
                                "Generate instruction descriptions"),
+                    clEnumValN(GenCallingConv, "gen-callingconv",
+                               "Generate calling convention descriptions"),
                     clEnumValN(GenAsmWriter, "gen-asm-writer",
                                "Generate assembly writer"),
                     clEnumValN(GenDAGISel, "gen-dag-isel",
@@ -138,7 +142,9 @@
     case GenInstrs:
       InstrInfoEmitter(Records).run(*Out);
       break;
-
+    case GenCallingConv:
+      CallingConvEmitter(Records).run(*Out);
+      break;
     case GenAsmWriter:
       AsmWriterEmitter(Records).run(*Out);
       break;






More information about the llvm-commits mailing list