summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Record.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2014-08-07 05:47:10 +0000
committerPete Cooper <peter_cooper@apple.com>2014-08-07 05:47:10 +0000
commit94891ddf0d633c3c31819c26c034659aea11210f (patch)
treeedcb4cda57471450c589c62a88fad62850c173cd /llvm/lib/TableGen/Record.cpp
parent0bf1ea72ee99857724956e45ec36bebdc7ed7828 (diff)
downloadbcm5719-llvm-94891ddf0d633c3c31819c26c034659aea11210f.tar.gz
bcm5719-llvm-94891ddf0d633c3c31819c26c034659aea11210f.zip
Update BitRecTy::convertValue to allow if expressions with bit values on both sides of the if
llvm-svn: 215087
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
-rw-r--r--llvm/lib/TableGen/Record.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 8267a364261..cb21be7b762 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -119,6 +119,16 @@ Init *BitRecTy::convertValue(TypedInit *VI) {
if (auto *BitsTy = dyn_cast<BitsRecTy>(Ty))
// Accept only bits<1> expression.
return BitsTy->getNumBits() == 1 ? VI : nullptr;
+ // Ternary !if can be converted to bit, but only if both sides are
+ // convertible to a bit.
+ if (TernOpInit *TOI = dyn_cast<TernOpInit>(VI)) {
+ if (TOI->getOpcode() != TernOpInit::TernaryOp::IF)
+ return nullptr;
+ if (!TOI->getMHS()->convertInitializerTo(BitRecTy::get()) ||
+ !TOI->getRHS()->convertInitializerTo(BitRecTy::get()))
+ return nullptr;
+ return TOI;
+ }
return nullptr;
}
OpenPOWER on IntegriCloud