From 6d7b4561848a4dc261bd617892397a13d72f96e2 Mon Sep 17 00:00:00 2001 From: Jean-Luc Duprat Date: Fri, 29 Aug 2014 19:41:04 +0000 Subject: Tablegen fixes for new syntax when initializing bits from variables. Followup to r215086. llvm-svn: 216757 --- llvm/lib/TableGen/TGParser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib') 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 can also come from variable initializers. + if (VarInit *VI = dyn_cast(Vals[i])) { + if (BitsRecTy *BitsRec = dyn_cast(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) { -- cgit v1.2.3