1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

Propagate debug loc.

llvm-svn: 107710
This commit is contained in:
Devang Patel 2010-07-06 22:08:15 +00:00
parent 084a11cb59
commit 7ab104353b
21 changed files with 64 additions and 54 deletions

View File

@ -348,13 +348,13 @@ public:
SDValue getTargetConstantFP(const ConstantFP &Val, EVT VT) { SDValue getTargetConstantFP(const ConstantFP &Val, EVT VT) {
return getConstantFP(Val, VT, true); return getConstantFP(Val, VT, true);
} }
SDValue getGlobalAddress(const GlobalValue *GV, EVT VT, SDValue getGlobalAddress(const GlobalValue *GV, DebugLoc DL, EVT VT,
int64_t offset = 0, bool isTargetGA = false, int64_t offset = 0, bool isTargetGA = false,
unsigned char TargetFlags = 0); unsigned char TargetFlags = 0);
SDValue getTargetGlobalAddress(const GlobalValue *GV, EVT VT, SDValue getTargetGlobalAddress(const GlobalValue *GV, DebugLoc DL, EVT VT,
int64_t offset = 0, int64_t offset = 0,
unsigned char TargetFlags = 0) { unsigned char TargetFlags = 0) {
return getGlobalAddress(GV, VT, offset, true, TargetFlags); return getGlobalAddress(GV, DL, VT, offset, true, TargetFlags);
} }
SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false); SDValue getFrameIndex(int FI, EVT VT, bool isTarget = false);
SDValue getTargetFrameIndex(int FI, EVT VT) { SDValue getTargetFrameIndex(int FI, EVT VT) {

View File

@ -1154,7 +1154,7 @@ class GlobalAddressSDNode : public SDNode {
int64_t Offset; int64_t Offset;
unsigned char TargetFlags; unsigned char TargetFlags;
friend class SelectionDAG; friend class SelectionDAG;
GlobalAddressSDNode(unsigned Opc, const GlobalValue *GA, EVT VT, GlobalAddressSDNode(unsigned Opc, DebugLoc DL, const GlobalValue *GA, EVT VT,
int64_t o, unsigned char TargetFlags); int64_t o, unsigned char TargetFlags);
public: public:

View File

@ -1315,7 +1315,7 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(N0)) if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(N0))
if (!LegalOperations && TLI.isOffsetFoldingLegal(GA) && N1C && if (!LegalOperations && TLI.isOffsetFoldingLegal(GA) && N1C &&
GA->getOpcode() == ISD::GlobalAddress) GA->getOpcode() == ISD::GlobalAddress)
return DAG.getGlobalAddress(GA->getGlobal(), VT, return DAG.getGlobalAddress(GA->getGlobal(), N1C->getDebugLoc(), VT,
GA->getOffset() + GA->getOffset() +
(uint64_t)N1C->getSExtValue()); (uint64_t)N1C->getSExtValue());
// fold ((c1-A)+c2) -> (c1+c2)-A // fold ((c1-A)+c2) -> (c1+c2)-A
@ -1552,7 +1552,7 @@ SDValue DAGCombiner::visitSUB(SDNode *N) {
if (!LegalOperations && TLI.isOffsetFoldingLegal(GA)) { if (!LegalOperations && TLI.isOffsetFoldingLegal(GA)) {
// fold (sub Sym, c) -> Sym-c // fold (sub Sym, c) -> Sym-c
if (N1C && GA->getOpcode() == ISD::GlobalAddress) if (N1C && GA->getOpcode() == ISD::GlobalAddress)
return DAG.getGlobalAddress(GA->getGlobal(), VT, return DAG.getGlobalAddress(GA->getGlobal(), N1C->getDebugLoc(), VT,
GA->getOffset() - GA->getOffset() -
(uint64_t)N1C->getSExtValue()); (uint64_t)N1C->getSExtValue());
// fold (sub Sym+c1, Sym+c2) -> c1-c2 // fold (sub Sym+c1, Sym+c2) -> c1-c2

View File

@ -975,7 +975,7 @@ SDValue SelectionDAG::getConstantFP(double Val, EVT VT, bool isTarget) {
} }
} }
SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV, SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV, DebugLoc DL,
EVT VT, int64_t Offset, EVT VT, int64_t Offset,
bool isTargetGA, bool isTargetGA,
unsigned char TargetFlags) { unsigned char TargetFlags) {
@ -1010,7 +1010,7 @@ SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV,
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0); return SDValue(E, 0);
SDNode *N = new (NodeAllocator) GlobalAddressSDNode(Opc, GV, VT, SDNode *N = new (NodeAllocator) GlobalAddressSDNode(Opc, DL, GV, VT,
Offset, TargetFlags); Offset, TargetFlags);
CSEMap.InsertNode(N, IP); CSEMap.InsertNode(N, IP);
AllNodes.push_back(N); AllNodes.push_back(N);
@ -5375,9 +5375,10 @@ HandleSDNode::~HandleSDNode() {
DropOperands(); DropOperands();
} }
GlobalAddressSDNode::GlobalAddressSDNode(unsigned Opc, const GlobalValue *GA, GlobalAddressSDNode::GlobalAddressSDNode(unsigned Opc, DebugLoc DL,
const GlobalValue *GA,
EVT VT, int64_t o, unsigned char TF) EVT VT, int64_t o, unsigned char TF)
: SDNode(Opc, DebugLoc(), getSDVTList(VT)), Offset(o), TargetFlags(TF) { : SDNode(Opc, DL, getSDVTList(VT)), Offset(o), TargetFlags(TF) {
TheGlobal = GA; TheGlobal = GA;
} }

View File

@ -852,7 +852,7 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
return DAG.getConstant(*CI, VT); return DAG.getConstant(*CI, VT);
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C)) if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
return DAG.getGlobalAddress(GV, VT); return DAG.getGlobalAddress(GV, getCurDebugLoc(), VT);
if (isa<ConstantPointerNull>(C)) if (isa<ConstantPointerNull>(C))
return DAG.getConstant(0, TLI.getPointerTy()); return DAG.getConstant(0, TLI.getPointerTy());

View File

@ -2415,6 +2415,7 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
int64_t Offs = GA->getOffset(); int64_t Offs = GA->getOffset();
if (C) Offs += C->getZExtValue(); if (C) Offs += C->getZExtValue();
Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(), Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(),
C->getDebugLoc(),
Op.getValueType(), Offs)); Op.getValueType(), Offs));
return; return;
} }

View File

@ -1238,7 +1238,7 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
Callee = DAG.getNode(ARMISD::PIC_ADD, dl, Callee = DAG.getNode(ARMISD::PIC_ADD, dl,
getPointerTy(), Callee, PICLabel); getPointerTy(), Callee, PICLabel);
} else } else
Callee = DAG.getTargetGlobalAddress(GV, getPointerTy()); Callee = DAG.getTargetGlobalAddress(GV, dl, getPointerTy());
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) { } else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
isDirect = true; isDirect = true;
bool isStub = Subtarget->isTargetDarwin() && bool isStub = Subtarget->isTargetDarwin() &&
@ -1769,7 +1769,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
// pair. This is always cheaper. // pair. This is always cheaper.
if (Subtarget->useMovt()) { if (Subtarget->useMovt()) {
return DAG.getNode(ARMISD::Wrapper, dl, PtrVT, return DAG.getNode(ARMISD::Wrapper, dl, PtrVT,
DAG.getTargetGlobalAddress(GV, PtrVT)); DAG.getTargetGlobalAddress(GV, dl, PtrVT));
} else { } else {
SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4); SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4);
CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);

View File

@ -643,10 +643,12 @@ SDValue AlphaTargetLowering::LowerOperation(SDValue Op,
case ISD::GlobalAddress: { case ISD::GlobalAddress: {
GlobalAddressSDNode *GSDN = cast<GlobalAddressSDNode>(Op); GlobalAddressSDNode *GSDN = cast<GlobalAddressSDNode>(Op);
const GlobalValue *GV = GSDN->getGlobal(); const GlobalValue *GV = GSDN->getGlobal();
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i64, GSDN->getOffset()); SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i64,
GSDN->getOffset());
// FIXME there isn't really any debug info here // FIXME there isn't really any debug info here
// if (!GV->hasWeakLinkage() && !GV->isDeclaration() && !GV->hasLinkOnceLinkage()) { // if (!GV->hasWeakLinkage() && !GV->isDeclaration()
// && !GV->hasLinkOnceLinkage()) {
if (GV->hasLocalLinkage()) { if (GV->hasLocalLinkage()) {
SDValue Hi = DAG.getNode(AlphaISD::GPRelHi, dl, MVT::i64, GA, SDValue Hi = DAG.getNode(AlphaISD::GPRelHi, dl, MVT::i64, GA,
DAG.getGLOBAL_OFFSET_TABLE(MVT::i64)); DAG.getGLOBAL_OFFSET_TABLE(MVT::i64));

View File

@ -143,7 +143,7 @@ SDValue BlackfinTargetLowering::LowerGlobalAddress(SDValue Op,
DebugLoc DL = Op.getDebugLoc(); DebugLoc DL = Op.getDebugLoc();
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
Op = DAG.getTargetGlobalAddress(GV, MVT::i32); Op = DAG.getTargetGlobalAddress(GV, DL, MVT::i32);
return DAG.getNode(BFISD::Wrapper, DL, MVT::i32, Op); return DAG.getNode(BFISD::Wrapper, DL, MVT::i32, Op);
} }
@ -356,7 +356,7 @@ BlackfinTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it. // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
// Likewise ExternalSymbol -> TargetExternalSymbol. // Likewise ExternalSymbol -> TargetExternalSymbol.
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32); Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl, MVT::i32);
else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32); Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32);

View File

@ -953,7 +953,8 @@ LowerGlobalAddress(SDValue Op, SelectionDAG &DAG, const SPUSubtarget *ST) {
EVT PtrVT = Op.getValueType(); EVT PtrVT = Op.getValueType();
GlobalAddressSDNode *GSDN = cast<GlobalAddressSDNode>(Op); GlobalAddressSDNode *GSDN = cast<GlobalAddressSDNode>(Op);
const GlobalValue *GV = GSDN->getGlobal(); const GlobalValue *GV = GSDN->getGlobal();
SDValue GA = DAG.getTargetGlobalAddress(GV, PtrVT, GSDN->getOffset()); SDValue GA = DAG.getTargetGlobalAddress(GV, Op.getDebugLoc(),
PtrVT, GSDN->getOffset());
const TargetMachine &TM = DAG.getTarget(); const TargetMachine &TM = DAG.getTarget();
SDValue Zero = DAG.getConstant(0, PtrVT); SDValue Zero = DAG.getConstant(0, PtrVT);
// FIXME there is no actual debug info here // FIXME there is no actual debug info here
@ -1232,7 +1233,7 @@ SPUTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
const GlobalValue *GV = G->getGlobal(); const GlobalValue *GV = G->getGlobal();
EVT CalleeVT = Callee.getValueType(); EVT CalleeVT = Callee.getValueType();
SDValue Zero = DAG.getConstant(0, PtrVT); SDValue Zero = DAG.getConstant(0, PtrVT);
SDValue GA = DAG.getTargetGlobalAddress(GV, CalleeVT); SDValue GA = DAG.getTargetGlobalAddress(GV, dl, CalleeVT);
if (!ST->usingLargeMem()) { if (!ST->usingLargeMem()) {
// Turn calls to targets that are defined (i.e., have bodies) into BRSL // Turn calls to targets that are defined (i.e., have bodies) into BRSL

View File

@ -404,7 +404,7 @@ LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
// FIXME there isn't actually debug info here // FIXME there isn't actually debug info here
DebugLoc dl = Op.getDebugLoc(); DebugLoc dl = Op.getDebugLoc();
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32); SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32);
return DAG.getNode(MBlazeISD::Wrap, dl, MVT::i32, GA); return DAG.getNode(MBlazeISD::Wrap, dl, MVT::i32, GA);
} }
@ -617,7 +617,7 @@ LowerCall(SDValue Chain, SDValue Callee, CallingConv::ID CallConv,
// node so that legalize doesn't hack it. // node so that legalize doesn't hack it.
unsigned char OpFlag = MBlazeII::MO_NO_FLAG; unsigned char OpFlag = MBlazeII::MO_NO_FLAG;
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl,
getPointerTy(), 0, OpFlag); getPointerTy(), 0, OpFlag);
else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee = DAG.getTargetExternalSymbol(S->getSymbol(),

View File

@ -272,7 +272,8 @@ bool MSP430DAGToDAGISel::SelectAddr(SDNode *Op, SDValue N,
AM.Base.Reg; AM.Base.Reg;
if (AM.GV) if (AM.GV)
Disp = CurDAG->getTargetGlobalAddress(AM.GV, MVT::i16, AM.Disp, Disp = CurDAG->getTargetGlobalAddress(AM.GV, Op->getDebugLoc(),
MVT::i16, AM.Disp,
0/*AM.SymbolFlags*/); 0/*AM.SymbolFlags*/);
else if (AM.CP) else if (AM.CP)
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i16, Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i16,

View File

@ -529,7 +529,7 @@ MSP430TargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee,
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it. // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
// Likewise ExternalSymbol -> TargetExternalSymbol. // Likewise ExternalSymbol -> TargetExternalSymbol.
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i16); Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl, MVT::i16);
else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i16); Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i16);
@ -642,7 +642,8 @@ SDValue MSP430TargetLowering::LowerGlobalAddress(SDValue Op,
int64_t Offset = cast<GlobalAddressSDNode>(Op)->getOffset(); int64_t Offset = cast<GlobalAddressSDNode>(Op)->getOffset();
// Create the TargetGlobalAddress node, folding in the constant offset. // Create the TargetGlobalAddress node, folding in the constant offset.
SDValue Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), Offset); SDValue Result = DAG.getTargetGlobalAddress(GV, Op.getDebugLoc(),
getPointerTy(), Offset);
return DAG.getNode(MSP430ISD::Wrapper, Op.getDebugLoc(), return DAG.getNode(MSP430ISD::Wrapper, Op.getDebugLoc(),
getPointerTy(), Result); getPointerTy(), Result);
} }

View File

@ -489,21 +489,21 @@ SDValue MipsTargetLowering::LowerGlobalAddress(SDValue Op,
// %gp_rel relocation // %gp_rel relocation
if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) { if (TLOF.IsGlobalInSmallSection(GV, getTargetMachine())) {
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, 0, SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
MipsII::MO_GPREL); MipsII::MO_GPREL);
SDValue GPRelNode = DAG.getNode(MipsISD::GPRel, dl, VTs, &GA, 1); SDValue GPRelNode = DAG.getNode(MipsISD::GPRel, dl, VTs, &GA, 1);
SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(MVT::i32); SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(MVT::i32);
return DAG.getNode(ISD::ADD, dl, MVT::i32, GOT, GPRelNode); return DAG.getNode(ISD::ADD, dl, MVT::i32, GOT, GPRelNode);
} }
// %hi/%lo relocation // %hi/%lo relocation
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, 0, SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
MipsII::MO_ABS_HILO); MipsII::MO_ABS_HILO);
SDValue HiPart = DAG.getNode(MipsISD::Hi, dl, VTs, &GA, 1); SDValue HiPart = DAG.getNode(MipsISD::Hi, dl, VTs, &GA, 1);
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, GA); SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, GA);
return DAG.getNode(ISD::ADD, dl, MVT::i32, HiPart, Lo); return DAG.getNode(ISD::ADD, dl, MVT::i32, HiPart, Lo);
} else { } else {
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32, 0, SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32, 0,
MipsII::MO_GOT); MipsII::MO_GOT);
SDValue ResNode = DAG.getLoad(MVT::i32, dl, SDValue ResNode = DAG.getLoad(MVT::i32, dl,
DAG.getEntryNode(), GA, NULL, 0, DAG.getEntryNode(), GA, NULL, 0,
@ -888,7 +888,7 @@ MipsTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
// node so that legalize doesn't hack it. // node so that legalize doesn't hack it.
unsigned char OpFlag = IsPIC ? MipsII::MO_GOT_CALL : MipsII::MO_NO_FLAG; unsigned char OpFlag = IsPIC ? MipsII::MO_GOT_CALL : MipsII::MO_NO_FLAG;
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl,
getPointerTy(), 0, OpFlag); getPointerTy(), 0, OpFlag);
else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee = DAG.getTargetExternalSymbol(S->getSymbol(),

View File

@ -672,7 +672,8 @@ SDValue PIC16TargetLowering::ExpandGlobalAddress(SDNode *N,
// FIXME there isn't really debug info here // FIXME there isn't really debug info here
DebugLoc dl = G->getDebugLoc(); DebugLoc dl = G->getDebugLoc();
SDValue TGA = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i8, SDValue TGA = DAG.getTargetGlobalAddress(G->getGlobal(), N->getDebugLoc(),
MVT::i8,
G->getOffset()); G->getOffset());
SDValue Offset = DAG.getConstant(0, MVT::i8); SDValue Offset = DAG.getConstant(0, MVT::i8);
@ -1428,7 +1429,7 @@ PIC16TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
// Considering the GlobalAddressNode case here. // Considering the GlobalAddressNode case here.
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) { if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
const GlobalValue *GV = G->getGlobal(); const GlobalValue *GV = G->getGlobal();
Callee = DAG.getTargetGlobalAddress(GV, MVT::i8); Callee = DAG.getTargetGlobalAddress(GV, dl, MVT::i8);
Name = G->getGlobal()->getName(); Name = G->getGlobal()->getName();
} else {// Considering the ExternalSymbol case here } else {// Considering the ExternalSymbol case here
ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Callee); ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Callee);

View File

@ -1203,11 +1203,11 @@ SDValue PPCTargetLowering::LowerGlobalAddress(SDValue Op,
SelectionDAG &DAG) const { SelectionDAG &DAG) const {
EVT PtrVT = Op.getValueType(); EVT PtrVT = Op.getValueType();
GlobalAddressSDNode *GSDN = cast<GlobalAddressSDNode>(Op); GlobalAddressSDNode *GSDN = cast<GlobalAddressSDNode>(Op);
const GlobalValue *GV = GSDN->getGlobal();
SDValue GA = DAG.getTargetGlobalAddress(GV, PtrVT, GSDN->getOffset());
SDValue Zero = DAG.getConstant(0, PtrVT);
// FIXME there isn't really any debug info here // FIXME there isn't really any debug info here
DebugLoc dl = GSDN->getDebugLoc(); DebugLoc dl = GSDN->getDebugLoc();
const GlobalValue *GV = GSDN->getGlobal();
SDValue GA = DAG.getTargetGlobalAddress(GV, dl, PtrVT, GSDN->getOffset());
SDValue Zero = DAG.getConstant(0, PtrVT);
const TargetMachine &TM = DAG.getTarget(); const TargetMachine &TM = DAG.getTarget();
@ -2470,7 +2470,8 @@ unsigned PrepareCall(SelectionDAG &DAG, SDValue &Callee, SDValue &InFlag,
// direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
// node so that legalize doesn't hack it. // node so that legalize doesn't hack it.
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl,
Callee.getValueType());
else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType()); Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType());
else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG)) else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG))

View File

@ -478,7 +478,7 @@ SparcTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it. // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
// Likewise ExternalSymbol -> TargetExternalSymbol. // Likewise ExternalSymbol -> TargetExternalSymbol.
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32); Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl, MVT::i32);
else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32); Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32);
@ -759,7 +759,7 @@ SDValue SparcTargetLowering::LowerGlobalAddress(SDValue Op,
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
// FIXME there isn't really any debug info here // FIXME there isn't really any debug info here
DebugLoc dl = Op.getDebugLoc(); DebugLoc dl = Op.getDebugLoc();
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32); SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32);
SDValue Hi = DAG.getNode(SPISD::Hi, dl, MVT::i32, GA); SDValue Hi = DAG.getNode(SPISD::Hi, dl, MVT::i32, GA);
SDValue Lo = DAG.getNode(SPISD::Lo, dl, MVT::i32, GA); SDValue Lo = DAG.getNode(SPISD::Lo, dl, MVT::i32, GA);

View File

@ -464,7 +464,7 @@ SystemZTargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee,
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it. // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
// Likewise ExternalSymbol -> TargetExternalSymbol. // Likewise ExternalSymbol -> TargetExternalSymbol.
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy()); Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl, getPointerTy());
else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), getPointerTy()); Callee = DAG.getTargetExternalSymbol(E->getSymbol(), getPointerTy());
@ -729,14 +729,14 @@ SDValue SystemZTargetLowering::LowerGlobalAddress(SDValue Op,
SDValue Result; SDValue Result;
if (!IsPic && !ExtraLoadRequired) { if (!IsPic && !ExtraLoadRequired) {
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), Offset); Result = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), Offset);
Offset = 0; Offset = 0;
} else { } else {
unsigned char OpFlags = 0; unsigned char OpFlags = 0;
if (ExtraLoadRequired) if (ExtraLoadRequired)
OpFlags = SystemZII::MO_GOTENT; OpFlags = SystemZII::MO_GOTENT;
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), 0, OpFlags); Result = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), 0, OpFlags);
} }
Result = DAG.getNode(SystemZISD::PCRelativeWrapper, dl, Result = DAG.getNode(SystemZISD::PCRelativeWrapper, dl,

View File

@ -223,7 +223,8 @@ namespace {
// These are 32-bit even in 64-bit mode since RIP relative offset // These are 32-bit even in 64-bit mode since RIP relative offset
// is 32-bit. // is 32-bit.
if (AM.GV) if (AM.GV)
Disp = CurDAG->getTargetGlobalAddress(AM.GV, MVT::i32, AM.Disp, Disp = CurDAG->getTargetGlobalAddress(AM.GV, DebugLoc(),
MVT::i32, AM.Disp,
AM.SymbolFlags); AM.SymbolFlags);
else if (AM.CP) else if (AM.CP)
Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32, Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32,

View File

@ -2107,7 +2107,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
OpFlags = X86II::MO_DARWIN_STUB; OpFlags = X86II::MO_DARWIN_STUB;
} }
Callee = DAG.getTargetGlobalAddress(GV, getPointerTy(), Callee = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(),
G->getOffset(), OpFlags); G->getOffset(), OpFlags);
} }
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) { } else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
@ -5248,10 +5248,10 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
if (OpFlags == X86II::MO_NO_FLAG && if (OpFlags == X86II::MO_NO_FLAG &&
X86::isOffsetSuitableForCodeModel(Offset, M)) { X86::isOffsetSuitableForCodeModel(Offset, M)) {
// A direct static reference to a global. // A direct static reference to a global.
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), Offset); Result = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), Offset);
Offset = 0; Offset = 0;
} else { } else {
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), 0, OpFlags); Result = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), 0, OpFlags);
} }
if (Subtarget->isPICStyleRIPRel() && if (Subtarget->isPICStyleRIPRel() &&
@ -5296,7 +5296,7 @@ GetTLSADDR(SelectionDAG &DAG, SDValue Chain, GlobalAddressSDNode *GA,
MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo(); MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo();
SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag); SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
DebugLoc dl = GA->getDebugLoc(); DebugLoc dl = GA->getDebugLoc();
SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(), SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(), dl,
GA->getValueType(0), GA->getValueType(0),
GA->getOffset(), GA->getOffset(),
OperandFlags); OperandFlags);
@ -5369,7 +5369,8 @@ static SDValue LowerToTLSExecModel(GlobalAddressSDNode *GA, SelectionDAG &DAG,
// emit "addl x@ntpoff,%eax" (local exec) or "addl x@indntpoff,%eax" (initial // emit "addl x@ntpoff,%eax" (local exec) or "addl x@indntpoff,%eax" (initial
// exec) // exec)
SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(), GA->getValueType(0), SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(), dl,
GA->getValueType(0),
GA->getOffset(), OperandFlags); GA->getOffset(), OperandFlags);
SDValue Offset = DAG.getNode(WrapperKind, dl, PtrVT, TGA); SDValue Offset = DAG.getNode(WrapperKind, dl, PtrVT, TGA);
@ -5426,12 +5427,10 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const {
OpFlag = X86II::MO_TLVP_PIC_BASE; OpFlag = X86II::MO_TLVP_PIC_BASE;
else else
OpFlag = X86II::MO_TLVP; OpFlag = X86II::MO_TLVP;
DebugLoc DL = Op.getDebugLoc();
SDValue Result = DAG.getTargetGlobalAddress(GA->getGlobal(), SDValue Result = DAG.getTargetGlobalAddress(GA->getGlobal(), DL,
getPointerTy(), getPointerTy(),
GA->getOffset(), OpFlag); GA->getOffset(), OpFlag);
DebugLoc DL = Op.getDebugLoc();
SDValue Offset = DAG.getNode(WrapperKind, DL, getPointerTy(), Result); SDValue Offset = DAG.getNode(WrapperKind, DL, getPointerTy(), Result);
// With PIC32, the address is actually $g + Offset. // With PIC32, the address is actually $g + Offset.
@ -10304,7 +10303,8 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
getTargetMachine()))) getTargetMachine())))
return; return;
Result = DAG.getTargetGlobalAddress(GV, GA->getValueType(0), Offset); Result = DAG.getTargetGlobalAddress(GV, Op.getDebugLoc(),
GA->getValueType(0), Offset);
break; break;
} }
} }

View File

@ -245,7 +245,7 @@ SDValue XCoreTargetLowering::
LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const
{ {
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32); SDValue GA = DAG.getTargetGlobalAddress(GV, Op.getDebugLoc(), MVT::i32);
// If it's a debug information descriptor, don't mess with it. // If it's a debug information descriptor, don't mess with it.
if (DAG.isVerifiedDebugInfoDesc(Op)) if (DAG.isVerifiedDebugInfoDesc(Op))
return GA; return GA;
@ -269,7 +269,7 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
DebugLoc dl = Op.getDebugLoc(); DebugLoc dl = Op.getDebugLoc();
// transform to label + getid() * size // transform to label + getid() * size
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
SDValue GA = DAG.getTargetGlobalAddress(GV, MVT::i32); SDValue GA = DAG.getTargetGlobalAddress(GV, dl, MVT::i32);
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV); const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
if (!GVar) { if (!GVar) {
// If GV is an alias then use the aliasee to determine size // If GV is an alias then use the aliasee to determine size
@ -919,7 +919,7 @@ XCoreTargetLowering::LowerCCCCallTo(SDValue Chain, SDValue Callee,
// turn it into a TargetGlobalAddress node so that legalize doesn't hack it. // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
// Likewise ExternalSymbol -> TargetExternalSymbol. // Likewise ExternalSymbol -> TargetExternalSymbol.
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32); Callee = DAG.getTargetGlobalAddress(G->getGlobal(), dl, MVT::i32);
else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee))
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32); Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32);