From 851bc0453350254cd45a91b6af9592003562d707 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 17 Jun 2008 02:01:22 +0000 Subject: [PATCH] Rather than avoiding to wrap ISD::DECLARE GV operand in X86ISD::Wrapper, simply handle it at dagisel time with x86 specific isel code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52377 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelDAGToDAG.cpp | 22 ++++++++++++++++++++++ lib/Target/X86/X86ISelLowering.cpp | 3 --- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index 5ee91226a26..e0b8e012956 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -1578,6 +1578,28 @@ SDNode *X86DAGToDAGISel::Select(SDOperand N) { return ResNode; break; } + + case ISD::DECLARE: { + // Handle DECLARE nodes here because the second operand may have been + // wrapped in X86ISD::Wrapper. + SDOperand Chain = Node->getOperand(0); + SDOperand N1 = Node->getOperand(1); + SDOperand N2 = Node->getOperand(2); + if (isa(N1) && + N2.getOpcode() == X86ISD::Wrapper && + isa(N2.getOperand(0))) { + int FI = cast(N1)->getIndex(); + GlobalValue *GV = + cast(N2.getOperand(0))->getGlobal(); + SDOperand Tmp1 = CurDAG->getTargetFrameIndex(FI, TLI.getPointerTy()); + SDOperand Tmp2 = CurDAG->getTargetGlobalAddress(GV, TLI.getPointerTy()); + AddToISelQueue(Chain); + SDOperand Ops[] = { Tmp1, Tmp2, Chain }; + return CurDAG->getTargetNode(TargetInstrInfo::DECLARE, + MVT::Other, Ops, 3); + } + break; + } } SDNode *ResNode = SelectCode(N); diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 11442b5fa58..4211508225f 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -4173,9 +4173,6 @@ SDOperand X86TargetLowering::LowerGlobalAddress(SDOperand Op, SelectionDAG &DAG) { GlobalValue *GV = cast(Op)->getGlobal(); SDOperand Result = DAG.getTargetGlobalAddress(GV, getPointerTy()); - // If it's a debug information descriptor, don't mess with it. - if (DAG.isVerifiedDebugInfoDesc(Op)) - return Result; Result = DAG.getNode(X86ISD::Wrapper, getPointerTy(), Result); // With PIC, the address is actually $g + Offset. if (getTargetMachine().getRelocationModel() == Reloc::PIC_ &&