diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-06-04 14:45:12 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-06-04 14:45:12 +0000 |
commit | ab390f0c419dcf05a158f19eba7fac4282042e4e (patch) | |
tree | 6049df424672d5abfb3f4cfa7aeb3fd157151ddf /llvm/utils/TableGen/CodeGenDAGPatterns.cpp | |
parent | 8cd2ee1f2446aa6b0164befafcb990d2a637f464 (diff) | |
download | bcm5719-llvm-ab390f0c419dcf05a158f19eba7fac4282042e4e.tar.gz bcm5719-llvm-ab390f0c419dcf05a158f19eba7fac4282042e4e.zip |
TableGen/DAGPatterns: Allow bit constants in addition to int constants
Summary:
Implicit casting is a simple quality of life improvement.
Change-Id: I3d2b31b8b8f12cbb1e84f691e359fa713a9c4b42
Reviewers: tra, simon_tatham, craig.topper, MartinO, arsenm
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D47432
llvm-svn: 333904
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 730d336ce94..3394afca6e2 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -2566,10 +2566,12 @@ TreePatternNodePtr TreePattern::ParseTreePattern(Init *TheInit, return Res; } - if (IntInit *II = dyn_cast<IntInit>(TheInit)) { + if (isa<IntInit>(TheInit) || isa<BitInit>(TheInit)) { if (!OpName.empty()) - error("Constant int argument should not have a name!"); - return std::make_shared<TreePatternNode>(II, 1); + error("Constant int or bit argument should not have a name!"); + if (isa<BitInit>(TheInit)) + TheInit = TheInit->convertInitializerTo(IntRecTy::get()); + return std::make_shared<TreePatternNode>(TheInit, 1); } if (BitsInit *BI = dyn_cast<BitsInit>(TheInit)) { |