summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen
diff options
context:
space:
mode:
authorJean-Luc Duprat <jduprat@apple.com>2014-08-29 19:41:04 +0000
committerJean-Luc Duprat <jduprat@apple.com>2014-08-29 19:41:04 +0000
commit6d7b4561848a4dc261bd617892397a13d72f96e2 (patch)
tree78b122aa86a2df9b9645f166ce6050e87460522a /llvm/lib/TableGen
parent6d5038c19c1ed84d3a3a0d6cc7011933d927d1dd (diff)
downloadbcm5719-llvm-6d7b4561848a4dc261bd617892397a13d72f96e2.tar.gz
bcm5719-llvm-6d7b4561848a4dc261bd617892397a13d72f96e2.zip
Tablegen fixes for new syntax when initializing bits from variables.
Followup to r215086. llvm-svn: 216757
Diffstat (limited to 'llvm/lib/TableGen')
-rw-r--r--llvm/lib/TableGen/TGParser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 9c061a8ae4c..7efaa66de27 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -1321,6 +1321,15 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType,
NewBits.push_back(BI->getBit((e - i) - 1));
continue;
}
+ // bits<n> can also come from variable initializers.
+ if (VarInit *VI = dyn_cast<VarInit>(Vals[i])) {
+ if (BitsRecTy *BitsRec = dyn_cast<BitsRecTy>(VI->getType())) {
+ for (unsigned i = 0, e = BitsRec->getNumBits(); i != e; ++i)
+ NewBits.push_back(VI->getBit((e - i) - 1));
+ continue;
+ }
+ // Fallthrough to try convert this to a bit.
+ }
// All other values must be convertible to just a single bit.
Init *Bit = Vals[i]->convertInitializerTo(BitRecTy::get());
if (!Bit) {
OpenPOWER on IntegriCloud