Legalize MERGE_VALUES, expand READCYCLECOUNTER correctly, so it doesn't

break control dependence.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-11-20 22:56:56 +00:00
parent 006e3e3649
commit 308575be66

View File

@ -561,6 +561,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,
Node->getOperand(1));
break;
case ISD::MERGE_VALUES:
return LegalizeOp(Node->getOperand(Op.ResNo));
case ISD::CopyFromReg:
Tmp1 = LegalizeOp(Node->getOperand(0));
if (Tmp1 != Node->getOperand(0))
@ -3338,15 +3340,18 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
break;
}
case ISD::READCYCLECOUNTER:
if (TLI.getOperationAction(ISD::READCYCLECOUNTER, VT) == TargetLowering::Custom) {
SDOperand Chain = LegalizeOp(Node->getOperand(0));
AddLegalizedOperand(SDOperand(Node, 1), Chain);
SDOperand t = TLI.LowerOperation(Op, DAG);
ExpandOp(t, Lo, Hi);
} else
assert(0 && "Must custom expand ReadCycleCounter");
case ISD::READCYCLECOUNTER: {
assert(TLI.getOperationAction(ISD::READCYCLECOUNTER, VT) ==
TargetLowering::Custom &&
"Must custom expand ReadCycleCounter");
SDOperand T = TLI.LowerOperation(Op, DAG);
assert(T.Val && "Node must be custom expanded!");
Lo = LegalizeOp(T.getValue(0));
Hi = LegalizeOp(T.getValue(1));
AddLegalizedOperand(SDOperand(Node, 1), // Remember we legalized the chain.
LegalizeOp(T.getValue(2)));
break;
}
// These operators cannot be expanded directly, emit them as calls to
// library functions.