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

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 27 22:41:01 PDT 2003


Changes in directory llvm/utils/TableGen:

Record.cpp updated: 1.8 -> 1.9
Record.h updated: 1.10 -> 1.11

---
Log message:

Allow initializing variable initializers with variables


---
Diffs of the changes:

Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.8 llvm/utils/TableGen/Record.cpp:1.9
--- llvm/utils/TableGen/Record.cpp:1.8	Thu Dec  5 22:42:10 2002
+++ llvm/utils/TableGen/Record.cpp	Sun Jul 27 22:39:57 2003
@@ -127,6 +127,15 @@
   return DI;
 }
 
+Init *RecordRecTy::convertValue(TypedInit *VI) {
+  // Ensure that VI is compatible with Rec.
+  if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(VI->getType()))
+    if (RRT->getRecord()->isSubClassOf(getRecord()) ||
+        RRT->getRecord() == getRecord())
+      return VI;
+  return 0;
+}
+
 //===----------------------------------------------------------------------===//
 //    Initializer implementations
 //===----------------------------------------------------------------------===//


Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.10 llvm/utils/TableGen/Record.h:1.11
--- llvm/utils/TableGen/Record.h:1.10	Fri Jul 25 12:32:51 2003
+++ llvm/utils/TableGen/Record.h	Sun Jul 27 22:39:57 2003
@@ -136,7 +136,8 @@
   Record *getRecord() const { return Rec; }
 
   Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
-  Init *convertValue(   DefInit *DI);
+  Init *convertValue(  DefInit *DI);
+  Init *convertValue(TypedInit *VI); 
 
   void print(std::ostream &OS) const;
 };





More information about the llvm-commits mailing list