Add basic support for integer constants in pattern results.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23817 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-10-19 04:30:56 +00:00
parent 2ac8510d68
commit 5d5a056092

View File

@ -665,8 +665,15 @@ TreePatternNode *TreePattern::ParseTreePattern(DagInit *Dag) {
Args.push_back(Dag->getArgName(i));
}
}
} else if (IntInit *II = dynamic_cast<IntInit*>(Arg)) {
TreePatternNode *Node = new TreePatternNode(II);
if (!Dag->getArgName(i).empty())
error("Constant int argument should not have a name!");
Children.push_back(Node);
} else {
std::cerr << '"';
Arg->dump();
std::cerr << "\": ";
error("Unknown leaf value for tree pattern!");
}
}
@ -1627,6 +1634,13 @@ CodeGenPatternResult(TreePatternNode *N, unsigned &Ctr,
<< ");\n";
return ResNo;
}
} else if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
unsigned ResNo = Ctr++;
OS << " SDOperand Tmp" << ResNo << " = CurDAG->getTargetConstant("
<< II->getValue() << ", MVT::"
<< getEnumName(N->getType())
<< ");\n";
return ResNo;
}
N->dump();