mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-13 14:35:54 +00:00
Allow bits init values to be used in patterns, turn them into ints.
llvm-svn: 27286
This commit is contained in:
parent
e330741a6c
commit
ef86937943
@ -830,6 +830,15 @@ TreePatternNode *TreePattern::ParseTreePattern(DagInit *Dag) {
|
||||
New = new TreePatternNode(II);
|
||||
if (!Dag->getArgName(0).empty())
|
||||
error("Constant int argument should not have a name!");
|
||||
} else if (BitsInit *BI = dynamic_cast<BitsInit*>(Arg)) {
|
||||
// Turn this into an IntInit.
|
||||
Init *II = BI->convertInitializerTo(new IntRecTy());
|
||||
if (II == 0 || !dynamic_cast<IntInit*>(II))
|
||||
error("Bits value must be constants!");
|
||||
|
||||
New = new TreePatternNode(dynamic_cast<IntInit*>(II));
|
||||
if (!Dag->getArgName(0).empty())
|
||||
error("Constant int argument should not have a name!");
|
||||
} else {
|
||||
Arg->dump();
|
||||
error("Unknown leaf value for tree pattern!");
|
||||
@ -888,6 +897,16 @@ TreePatternNode *TreePattern::ParseTreePattern(DagInit *Dag) {
|
||||
if (!Dag->getArgName(i).empty())
|
||||
error("Constant int argument should not have a name!");
|
||||
Children.push_back(Node);
|
||||
} else if (BitsInit *BI = dynamic_cast<BitsInit*>(Arg)) {
|
||||
// Turn this into an IntInit.
|
||||
Init *II = BI->convertInitializerTo(new IntRecTy());
|
||||
if (II == 0 || !dynamic_cast<IntInit*>(II))
|
||||
error("Bits value must be constants!");
|
||||
|
||||
TreePatternNode *Node = new TreePatternNode(dynamic_cast<IntInit*>(II));
|
||||
if (!Dag->getArgName(i).empty())
|
||||
error("Constant int argument should not have a name!");
|
||||
Children.push_back(Node);
|
||||
} else {
|
||||
std::cerr << '"';
|
||||
Arg->dump();
|
||||
|
Loading…
Reference in New Issue
Block a user