1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

More fixes for Selection of copyto/fromreg with a flag

llvm-svn: 24829
This commit is contained in:
Chris Lattner 2005-12-18 15:45:51 +00:00
parent deb7eb58be
commit 5dfbcbb8be

View File

@ -2353,7 +2353,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
<< " SDOperand Chain = Select(N.getOperand(0));\n"
<< " unsigned Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();\n"
<< " MVT::ValueType VT = N.Val->getValueType(0);\n"
<< " if (N.getNumOperands() == 2) {\n"
<< " if (N.Val->getNumValues() == 2) {\n"
<< " if (Chain == N.getOperand(0)) return N; // No change\n"
<< " SDOperand New = CurDAG->getCopyFromReg(Chain, Reg, VT);\n"
<< " CodeGenMap[N.getValue(0)] = New;\n"
@ -2361,8 +2361,9 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
<< " return New.getValue(N.ResNo);\n"
<< " } else {\n"
<< " SDOperand Flag;\n"
<< " if (N.getOperand(2).Val) Flag = Select(N.getOperand(2));\n"
<< " if (Chain == N.getOperand(0) && Flag == N.getOperand(2))\n"
<< " if (N.getNumOperands() == 3) Flag = Select(N.getOperand(2));\n"
<< " if (Chain == N.getOperand(0) &&\n"
<< " (N.getNumOperands() == 2 || Flag == N.getOperand(2)))\n"
<< " return N; // No change\n"
<< " SDOperand New = CurDAG->getCopyFromReg(Chain, Reg, VT, Flag);\n"
<< " CodeGenMap[N.getValue(0)] = New;\n"
@ -2373,21 +2374,19 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
<< " }\n"
<< " case ISD::CopyToReg: {\n"
<< " SDOperand Chain = Select(N.getOperand(0));\n"
<< " SDOperand Reg = N.getOperand(1);\n"
<< " unsigned Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();\n"
<< " SDOperand Val = Select(N.getOperand(2));\n"
<< " SDOperand Result = N;\n"
<< " if (N.getNumOperands() == 3) {\n"
<< " if (N.Val->getNumValues() == 1) {\n"
<< " if (Chain != N.getOperand(0) || Val != N.getOperand(2))\n"
<< " Result = CurDAG->getNode(ISD::CopyToReg, MVT::Other,\n"
<< " Chain, Reg, Val);\n"
<< " Result = CurDAG->getCopyToReg(Chain, Reg, Val);\n"
<< " return CodeGenMap[N] = Result;\n"
<< " } else {\n"
<< " SDOperand Flag;\n"
<< " if (N.getOperand(3).Val) Flag = Select(N.getOperand(3));\n"
<< " if (N.getNumOperands() == 4) Flag = Select(N.getOperand(3));\n"
<< " if (Chain != N.getOperand(0) || Val != N.getOperand(2) ||\n"
<< " Flag != N.getOperand(3))\n"
<< " Result = CurDAG->getNode(ISD::CopyToReg, MVT::Other,\n"
<< " Chain, Reg, Val, Flag);\n"
<< " (N.getNumOperands() == 4 && Flag != N.getOperand(3)))\n"
<< " Result = CurDAG->getCopyToReg(Chain, Reg, Val, Flag);\n"
<< " CodeGenMap[N.getValue(0)] = Result;\n"
<< " CodeGenMap[N.getValue(1)] = Result.getValue(1);\n"
<< " return Result.getValue(N.ResNo);\n"