mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
legalize target-specific operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
89c34637cb
commit
d73cc5d058
@ -197,6 +197,29 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
||||
|
||||
switch (Node->getOpcode()) {
|
||||
default:
|
||||
if (Node->getOpcode() >= ISD::BUILTIN_OP_END) {
|
||||
// If this is a target node, legalize it by legalizing the operands then
|
||||
// passing it through.
|
||||
std::vector<SDOperand> Ops;
|
||||
bool Changed = false;
|
||||
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
|
||||
Ops.push_back(LegalizeOp(Node->getOperand(i)));
|
||||
Changed = Changed || Node->getOperand(i) != Ops.back();
|
||||
}
|
||||
if (Changed)
|
||||
if (Node->getNumValues() == 1)
|
||||
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Ops);
|
||||
else {
|
||||
std::vector<MVT::ValueType> VTs(Node->value_begin(),
|
||||
Node->value_end());
|
||||
Result = DAG.getNode(Node->getOpcode(), VTs, Ops);
|
||||
}
|
||||
|
||||
for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
|
||||
AddLegalizedOperand(Op.getValue(i), Result.getValue(i));
|
||||
return Result.getValue(Op.ResNo);
|
||||
}
|
||||
// Otherwise this is an unhandled builtin node. splat.
|
||||
std::cerr << "NODE: "; Node->dump(); std::cerr << "\n";
|
||||
assert(0 && "Do not know how to legalize this operator!");
|
||||
abort();
|
||||
|
Loading…
Reference in New Issue
Block a user