mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-06 09:44:39 +00:00
Select copytoreg and copyfromreg nodes that have flag operands correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24827 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7310fb11f2
commit
755dd09815
@ -2324,7 +2324,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
|
||||
<< " 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 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
|
||||
<< " }\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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user