[llvm] r333904 - TableGen/DAGPatterns: Allow bit constants in addition to int constants
Nicolai Haehnle via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 4 07:45:12 PDT 2018
Author: nha
Date: Mon Jun 4 07:45:12 2018
New Revision: 333904
URL: http://llvm.org/viewvc/llvm-project?rev=333904&view=rev
Log:
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
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=333904&r1=333903&r2=333904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Mon Jun 4 07:45:12 2018
@@ -2566,10 +2566,12 @@ TreePatternNodePtr TreePattern::ParseTre
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)) {
More information about the llvm-commits
mailing list