Support Custom lowering of a few more operations.

Alpha needs to custom lower *DIV and *REM

llvm-svn: 25006
This commit is contained in:
Andrew Lenharth 2005-12-24 23:42:32 +00:00
parent 0dc12c38e5
commit 7259426d88
1 changed files with 31 additions and 5 deletions

View File

@ -537,6 +537,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
case ISD::GlobalAddress: case ISD::GlobalAddress:
case ISD::TargetGlobalAddress: case ISD::TargetGlobalAddress:
case ISD::ExternalSymbol: case ISD::ExternalSymbol:
case ISD::TargetExternalSymbol:
case ISD::ConstantPool: // Nothing to do. case ISD::ConstantPool: // Nothing to do.
case ISD::BasicBlock: case ISD::BasicBlock:
case ISD::CONDCODE: case ISD::CONDCODE:
@ -1954,9 +1955,25 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Tmp2 = PromoteOp(Node->getOperand(1)); // Promote the RHS. Tmp2 = PromoteOp(Node->getOperand(1)); // Promote the RHS.
break; break;
} }
if (Tmp1 != Node->getOperand(0) || switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
Tmp2 != Node->getOperand(1)) case TargetLowering::Legal:
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2); if (Tmp1 != Node->getOperand(0) ||
Tmp2 != Node->getOperand(1))
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2);
break;
case TargetLowering::Custom: {
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2);
SDOperand Tmp = TLI.LowerOperation(Result, DAG);
if (Tmp.Val) {
Tmp = LegalizeOp(Tmp); // Relegalize input.
AddLegalizedOperand(Op, Tmp);
return Tmp;
}
break;
}
default:
assert(0 && "Operation not supported");
}
break; break;
case ISD::BUILD_PAIR: { case ISD::BUILD_PAIR: {
@ -1997,8 +2014,17 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Tmp2); Tmp2);
break; break;
case TargetLowering::Promote: case TargetLowering::Promote:
case TargetLowering::Custom: assert(0 && "Cannot promote handle this yet!");
assert(0 && "Cannot promote/custom handle this yet!"); case TargetLowering::Custom: {
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2);
SDOperand Tmp = TLI.LowerOperation(Result, DAG);
if (Tmp.Val) {
Tmp = LegalizeOp(Tmp); // Relegalize input.
AddLegalizedOperand(Op, Tmp);
return Tmp;
}
break;
}
case TargetLowering::Expand: case TargetLowering::Expand:
if (MVT::isInteger(Node->getValueType(0))) { if (MVT::isInteger(Node->getValueType(0))) {
MVT::ValueType VT = Node->getValueType(0); MVT::ValueType VT = Node->getValueType(0);