[llvm-commits] CVS: llvm/utils/TableGen/Record.cpp Record.h
Chris Lattner
lattner at cs.uiuc.edu
Tue Jul 29 23:06:00 PDT 2003
Changes in directory llvm/utils/TableGen:
Record.cpp updated: 1.9 -> 1.10
Record.h updated: 1.11 -> 1.12
---
Log message:
Implement resolution of variables to the value of the variable once it gets a value
---
Diffs of the changes:
Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.9 llvm/utils/TableGen/Record.cpp:1.10
--- llvm/utils/TableGen/Record.cpp:1.9 Sun Jul 27 22:39:57 2003
+++ llvm/utils/TableGen/Record.cpp Tue Jul 29 23:05:07 2003
@@ -215,6 +215,9 @@
return false;
}
+// resolveReferences - If there are any field references that refer to fields
+// that have been filled in, we can propagate the values now.
+//
Init *BitsInit::resolveReferences(Record &R) {
bool Changed = false;
BitsInit *New = new BitsInit(getNumBits());
@@ -309,7 +312,18 @@
return 0;
}
-
+/// resolveReferences - This method is used by classes that refer to other
+/// variables which may not be defined at the time they expression is formed.
+/// If a value is set for the variable later, this method will be called on
+/// users of the value to allow the value to propagate out.
+///
+Init *VarInit::resolveReferences(Record &R) {
+ if (RecordVal *Val = R.getValue(VarName))
+ if (!dynamic_cast<UnsetInit*>(Val->getValue()))
+ return Val->getValue();
+ return this;
+}
+
Init *VarBitInit::resolveReferences(Record &R) {
Init *I = getVariable()->resolveBitReference(R, getBitNum());
Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.11 llvm/utils/TableGen/Record.h:1.12
--- llvm/utils/TableGen/Record.h:1.11 Sun Jul 27 22:39:57 2003
+++ llvm/utils/TableGen/Record.h Tue Jul 29 23:05:07 2003
@@ -365,6 +365,13 @@
virtual RecTy *getFieldType(const std::string &FieldName) const;
virtual Init *getFieldInit(Record &R, const std::string &FieldName) const;
+
+ /// resolveReferences - This method is used by classes that refer to other
+ /// variables which may not be defined at the time they expression is formed.
+ /// If a value is set for the variable later, this method will be called on
+ /// users of the value to allow the value to propagate out.
+ ///
+ virtual Init *resolveReferences(Record &R);
virtual void print(std::ostream &OS) const { OS << VarName; }
};
More information about the llvm-commits
mailing list