summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Record.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
-rw-r--r--llvm/lib/TableGen/Record.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 9fd8b94e4af..2fbe4cc493f 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -1633,16 +1633,17 @@ Init *FieldInit::getBit(unsigned Bit) const {
Init *FieldInit::resolveReferences(Resolver &R) const {
Init *NewRec = Rec->resolveReferences(R);
+ if (NewRec != Rec)
+ return FieldInit::get(NewRec, FieldName)->Fold();
+ return const_cast<FieldInit *>(this);
+}
- if (DefInit *DI = dyn_cast<DefInit>(NewRec)) {
+Init *FieldInit::Fold() const {
+ if (DefInit *DI = dyn_cast<DefInit>(Rec)) {
Init *FieldVal = DI->getDef()->getValue(FieldName)->getValue();
- Init *BVR = FieldVal->resolveReferences(R);
- if (BVR->isComplete())
- return BVR;
+ if (FieldVal->isComplete())
+ return FieldVal;
}
-
- if (NewRec != Rec)
- return FieldInit::get(NewRec, FieldName);
return const_cast<FieldInit *>(this);
}
OpenPOWER on IntegriCloud