[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Dec 18 07:28:37 PST 2005
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.100 -> 1.101
---
Log message:
Select copytoreg and copyfromreg nodes that have flag operands correctly.
---
Diffs of the changes: (+37 -9)
DAGISelEmitter.cpp | 46 +++++++++++++++++++++++++++++++++++++---------
1 files changed, 37 insertions(+), 9 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.100 llvm/utils/TableGen/DAGISelEmitter.cpp:1.101
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.100 Fri Dec 16 19:19:28 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Sun Dec 18 09:28:25 2005
@@ -2324,7 +2324,7 @@
<< " N.getOpcode() < (ISD::BUILTIN_OP_END+" << InstNS
<< "INSTRUCTION_LIST_END))\n"
<< " return N; // Already selected.\n\n"
- << " std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);\n"
+ << " std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);\n"
<< " if (CGMI != CodeGenMap.end()) return CGMI->second;\n"
<< " switch (N.getOpcode()) {\n"
<< " default: break;\n"
@@ -2351,19 +2351,47 @@
<< " }\n"
<< " case ISD::CopyFromReg: {\n"
<< " SDOperand Chain = Select(N.getOperand(0));\n"
- << " if (Chain == N.getOperand(0)) return N; // No change\n"
- << " SDOperand New = CurDAG->getCopyFromReg(Chain,\n"
- << " cast<RegisterSDNode>(N.getOperand(1))->getReg(),\n"
- << " N.Val->getValueType(0));\n"
- << " return New.getValue(N.ResNo);\n"
+ << " unsigned Reg = cast<RegisterSDNode>(N.getOperand(1))->getReg();\n"
+ << " MVT::ValueType VT = N.Val->getValueType(0);\n"
+ << " if (N.getNumOperands() == 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"
+ << " CodeGenMap[N.getValue(1)] = New.getValue(1);\n"
+ << " 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"
+ << " return N; // No change\n"
+ << " SDOperand New = CurDAG->getCopyFromReg(Chain, Reg, VT, Flag);\n"
+ << " CodeGenMap[N.getValue(0)] = New;\n"
+ << " CodeGenMap[N.getValue(1)] = New.getValue(1);\n"
+ << " CodeGenMap[N.getValue(2)] = New.getValue(2);\n"
+ << " return New.getValue(N.ResNo);\n"
+ << " }\n"
<< " }\n"
<< " case ISD::CopyToReg: {\n"
<< " SDOperand Chain = Select(N.getOperand(0));\n"
<< " SDOperand Reg = N.getOperand(1);\n"
<< " SDOperand Val = Select(N.getOperand(2));\n"
- << " return CodeGenMap[N] = \n"
- << " CurDAG->getNode(ISD::CopyToReg, MVT::Other,\n"
- << " Chain, Reg, Val);\n"
+ << " SDOperand Result = N;\n"
+ << " if (N.getNumOperands() == 3) {\n"
+ << " if (Chain != N.getOperand(0) || Val != N.getOperand(2))\n"
+ << " Result = CurDAG->getNode(ISD::CopyToReg, MVT::Other,\n"
+ << " 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 (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"
+ << " CodeGenMap[N.getValue(0)] = Result;\n"
+ << " CodeGenMap[N.getValue(1)] = Result.getValue(1);\n"
+ << " return Result.getValue(N.ResNo);\n"
+ << " }\n"
<< " }\n";
// Group the patterns by their top-level opcodes.
More information about the llvm-commits
mailing list