summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelEmitter.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-02-02 04:07:54 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-02-02 04:07:54 +0000
commita844bdeab31ef04221e7ef59a8467893584cc14d (patch)
tree0536e06ef73d25184c28dd72de26a26cfda1a4d1 /utils/TableGen/DAGISelEmitter.cpp
parent1cf47cb21728c84342b15d9695b8a2433b3315a2 (diff)
downloadllvm-a844bdeab31ef04221e7ef59a8467893584cc14d.tar.gz
llvm-a844bdeab31ef04221e7ef59a8467893584cc14d.tar.bz2
llvm-a844bdeab31ef04221e7ef59a8467893584cc14d.tar.xz
SDIsel processes llvm.dbg.declare by recording the variable debug information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc.
Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes. For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index ae62c9fcb2..493330a689 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1779,6 +1779,30 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
<< " MVT::Other, Ops, 3);\n"
<< "}\n\n";
+ OS << "SDNode *Select_DECLARE(const SDOperand &N) {\n"
+ << " MachineModuleInfo *MMI = CurDAG->getMachineModuleInfo();\n"
+ << " SDOperand Chain = N.getOperand(0);\n"
+ << " SDOperand N1 = N.getOperand(1);\n"
+ << " SDOperand N2 = N.getOperand(2);\n"
+ << " if (!isa<FrameIndexSDNode>(N1) || !isa<GlobalAddressSDNode>(N2)) {\n"
+ << " cerr << \"Cannot yet select llvm.dbg.declare: \";\n"
+ << " N.Val->dump(CurDAG);\n"
+ << " abort();\n"
+ << " }\n"
+ << " int FI = cast<FrameIndexSDNode>(N1)->getIndex();\n"
+ << " GlobalValue *GV = cast<GlobalAddressSDNode>(N2)->getGlobal();\n"
+ << " // FIXME. Handle variable declarations later since it lives on.\n"
+ << " MMI->RecordVariable(GV, FI);\n"
+ << " SDOperand Tmp1 = "
+ << "CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy());\n"
+ << " SDOperand Tmp2 = "
+ << "CurDAG->getTargetGlobalAddress(GV, TLI.getPointerTy());\n"
+ << " AddToISelQueue(Chain);\n"
+ << " SDOperand Ops[] = { Tmp1, Tmp2, Chain };\n"
+ << " return CurDAG->getTargetNode(TargetInstrInfo::DECLARE,\n"
+ << " MVT::Other, Ops, 3);\n"
+ << "}\n\n";
+
OS << "SDNode *Select_EXTRACT_SUBREG(const SDOperand &N) {\n"
<< " SDOperand N0 = N.getOperand(0);\n"
<< " SDOperand N1 = N.getOperand(1);\n"
@@ -1846,6 +1870,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
<< " }\n"
<< " case ISD::INLINEASM: return Select_INLINEASM(N);\n"
<< " case ISD::LABEL: return Select_LABEL(N);\n"
+ << " case ISD::DECLARE: return Select_DECLARE(N);\n"
<< " case ISD::EXTRACT_SUBREG: return Select_EXTRACT_SUBREG(N);\n"
<< " case ISD::INSERT_SUBREG: return Select_INSERT_SUBREG(N);\n";