aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-02-06 08:12:55 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-02-06 08:12:55 +0000
commit7cd19d038f63330bbafcaa004b41fec272d1220e (patch)
treee40ed2102923cfd1e01e381ee2a1a51f3ff474e5 /utils
parent024524fe9b08dbfa81ea5a8a46905ceda970392b (diff)
downloadexternal_llvm-7cd19d038f63330bbafcaa004b41fec272d1220e.zip
external_llvm-7cd19d038f63330bbafcaa004b41fec272d1220e.tar.gz
external_llvm-7cd19d038f63330bbafcaa004b41fec272d1220e.tar.bz2
At the end of isel, select a replacement node for each handle that does not
have one. This can happen if a load's real uses are dead (i.e. they do not have uses themselves). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26014 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 96d71d0..2b8dabe 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -2856,7 +2856,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
<< "CurDAG->getNode(ISD::HANDLENODE, MVT::Other, N);\n"
<< " CodeGenMap[N.getValue(" << OpcodeInfo.getNumResults()
<< ")] = Dummy;\n"
- << " HolderMap[N.getValue(" << OpcodeInfo.getNumResults()
+ << " HandleMap[N.getValue(" << OpcodeInfo.getNumResults()
<< ")] = Dummy;\n"
<< " return Dummy;\n"
<< " }\n";
@@ -3061,9 +3061,9 @@ void DAGISelEmitter::run(std::ostream &OS) {
<< "std::map<SDOperand, SDOperand> CodeGenMap;\n";
OS << "// Instance var to keep track of mapping of chain generating nodes\n"
- << "// and their place holder nodes.\n";
- OS << "std::map<SDOperand, SDOperand> HolderMap;\n";
- OS << "// Instance var to keep track of mapping of place holder nodes\n"
+ << "// and their place handle nodes.\n";
+ OS << "std::map<SDOperand, SDOperand> HandleMap;\n";
+ OS << "// Instance var to keep track of mapping of place handle nodes\n"
<< "// and their replacement nodes.\n";
OS << "std::map<SDOperand, SDOperand> ReplaceMap;\n";
@@ -3100,19 +3100,31 @@ void DAGISelEmitter::run(std::ostream &OS) {
OS << "\n";
OS << "// AddHandleReplacement - Note the pending replacement node for a\n"
- << "// holder node in ReplaceMap.\n";
+ << "// handle node in ReplaceMap.\n";
OS << "void AddHandleReplacement(SDOperand N, SDOperand R) {\n";
- OS << " std::map<SDOperand, SDOperand>::iterator HMI = HolderMap.find(N);\n";
- OS << " if (HMI != HolderMap.end()) {\n";
+ OS << " std::map<SDOperand, SDOperand>::iterator HMI = HandleMap.find(N);\n";
+ OS << " if (HMI != HandleMap.end()) {\n";
OS << " ReplaceMap[HMI->second] = R;\n";
- OS << " HolderMap.erase(N);\n";
+ OS << " HandleMap.erase(N);\n";
OS << " }\n";
OS << "}\n";
OS << "\n";
- OS << "// ReplaceHolders - Replace all the holders with the real target\n";
+ OS << "// SelectDanglingHandles - Select replacements for all `dangling`\n";
+ OS << "// handles.Some handles do not yet have replacements because the\n";
+ OS << "// nodes they replacements have only dead readers.\n";
+ OS << "void SelectDanglingHandles() {\n";
+ OS << " for (std::map<SDOperand, SDOperand>::iterator I = "
+ << "HandleMap.begin(),\n"
+ << " E = HandleMap.end(); I != E; ++I) {\n";
+ OS << " SDOperand N = I->first;\n";
+ OS << " AddHandleReplacement(N, Select(N.getValue(0)));\n";
+ OS << " }\n";
+ OS << "}\n";
+ OS << "\n";
+ OS << "// ReplaceHandles - Replace all the handles with the real target\n";
OS << "// specific nodes.\n";
- OS << "void ReplaceHolders() {\n";
+ OS << "void ReplaceHandles() {\n";
OS << " for (std::map<SDOperand, SDOperand>::iterator I = "
<< "ReplaceMap.begin(),\n"
<< " E = ReplaceMap.end(); I != E; ++I) {\n";
@@ -3139,7 +3151,8 @@ void DAGISelEmitter::run(std::ostream &OS) {
OS << "// SelectRoot - Top level entry to DAG isel.\n";
OS << "SDOperand SelectRoot(SDOperand N) {\n";
OS << " SDOperand RetVal = Select(N);\n";
- OS << " ReplaceHolders();\n";
+ OS << " SelectDanglingHandles();\n";
+ OS << " ReplaceHandles();\n";
OS << " ReplaceMap.clear();\n";
OS << " return RetVal;\n";
OS << "}\n";