forked from OSchip/llvm-project
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
This commit is contained in:
parent
8cd2ee1f24
commit
ab390f0c41
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue