aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-01-12 19:35:54 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-01-12 19:35:54 +0000
commitf805c2ed7f8e13c18913a90542f3084a30222e84 (patch)
treec65555d9d05cb46f7834ca3dbb7f5c2f29ef3141 /utils/TableGen
parent5166b82866085db7ecb8a3fef790232faeec74ed (diff)
downloadexternal_llvm-f805c2ed7f8e13c18913a90542f3084a30222e84.zip
external_llvm-f805c2ed7f8e13c18913a90542f3084a30222e84.tar.gz
external_llvm-f805c2ed7f8e13c18913a90542f3084a30222e84.tar.bz2
Allow transformation from GlobalAddress to TargetGlobalAddress and
ExternalSymbol to TargetExternalSymbol. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index ca42679..97f7c15 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1826,7 +1826,9 @@ private:
unsigned PatternNo;
std::ostream &OS;
// Node to name mapping
- std::map<std::string,std::string> VariableMap;
+ std::map<std::string, std::string> VariableMap;
+ // Node to operator mapping
+ std::map<std::string, Record*> OperatorMap;
// Names of all the folded nodes which produce chains.
std::vector<std::pair<std::string, unsigned> > FoldedChains;
unsigned TmpNo;
@@ -1892,6 +1894,9 @@ public:
<< ") goto P" << PatternNo << "Fail;\n";
return;
}
+
+ if (!N->isLeaf())
+ OperatorMap[N->getName()] = N->getOperator();
}
@@ -2023,20 +2028,26 @@ public:
OS << " SDOperand Tmp" << utostr(ResNo)
<< " = CurDAG->getTargetConstant(Tmp"
<< ResNo << "C, MVT::" << getEnumName(N->getTypeNum(0)) << ");\n";
- } else if (!N->isLeaf() && N->getOperator()->getName() == "globaladdr") {
- OS << " SDOperand Tmp" << ResNo
- << " = CurDAG->getTargetGlobalAddress(cast<GlobalAddressSDNode>("
- << Val << ")->getGlobal(), MVT::" << getEnumName(N->getTypeNum(0))
- << ");\n";
- } else if (!N->isLeaf() && N->getOperator()->getName() == "externalsym") {
- OS << " SDOperand Tmp" << ResNo
- << " = CurDAG->getTargetExternalSymbol(cast<ExternalSymbolSDNode>("
- << Val << ")->getSymbol(), MVT::" << getEnumName(N->getTypeNum(0))
- << ");\n";
} else if (!N->isLeaf() && N->getOperator()->getName() == "texternalsym"){
- OS << " SDOperand Tmp" << ResNo << " = " << Val << ";\n";
+ Record *Op = OperatorMap[N->getName()];
+ // Transform ExternalSymbol to TargetExternalSymbol
+ if (Op && Op->getName() == "externalsym") {
+ OS << " SDOperand Tmp" << ResNo
+ << " = CurDAG->getTargetExternalSymbol(cast<ExternalSymbolSDNode>("
+ << Val << ")->getSymbol(), MVT::" << getEnumName(N->getTypeNum(0))
+ << ");\n";
+ } else
+ OS << " SDOperand Tmp" << ResNo << " = " << Val << ";\n";
} else if (!N->isLeaf() && N->getOperator()->getName() == "tglobaladdr") {
- OS << " SDOperand Tmp" << ResNo << " = " << Val << ";\n";
+ Record *Op = OperatorMap[N->getName()];
+ // Transform GlobalAddress to TargetGlobalAddress
+ if (Op && Op->getName() == "globaladdr") {
+ OS << " SDOperand Tmp" << ResNo
+ << " = CurDAG->getTargetGlobalAddress(cast<GlobalAddressSDNode>("
+ << Val << ")->getGlobal(), MVT::" << getEnumName(N->getTypeNum(0))
+ << ");\n";
+ } else
+ OS << " SDOperand Tmp" << ResNo << " = " << Val << ";\n";
} else if (!N->isLeaf() && N->getOperator()->getName() == "texternalsym"){
OS << " SDOperand Tmp" << ResNo << " = " << Val << ";\n";
} else if (!N->isLeaf() && N->getOperator()->getName() == "tconstpool") {