Make LowerCallTo and LowerArguments take a DebugLoc

argument.  Adjust all callers and overloaded versions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63444 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2009-01-30 23:10:59 +00:00
parent d34470c4f7
commit 7d2ad624fa
17 changed files with 83 additions and 53 deletions

View File

@ -29,6 +29,7 @@
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/Codegen/DebugLoc.h"
#include <climits> #include <climits>
#include <map> #include <map>
#include <vector> #include <vector>
@ -1059,7 +1060,7 @@ public:
/// lower the arguments for the specified function, into the specified DAG. /// lower the arguments for the specified function, into the specified DAG.
virtual void virtual void
LowerArguments(Function &F, SelectionDAG &DAG, LowerArguments(Function &F, SelectionDAG &DAG,
SmallVectorImpl<SDValue>& ArgValues); SmallVectorImpl<SDValue>& ArgValues, DebugLoc dl);
/// LowerCallTo - This hook lowers an abstract call to a function into an /// LowerCallTo - This hook lowers an abstract call to a function into an
/// actual call. This returns a pair of operands. The first element is the /// actual call. This returns a pair of operands. The first element is the
@ -1084,7 +1085,7 @@ public:
LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt, LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt,
bool isVarArg, bool isInreg, unsigned CallingConv, bool isVarArg, bool isInreg, unsigned CallingConv,
bool isTailCall, SDValue Callee, ArgListTy &Args, bool isTailCall, SDValue Callee, ArgListTy &Args,
SelectionDAG &DAG); SelectionDAG &DAG, DebugLoc dl);
/// EmitTargetCodeForMemcpy - Emit target-specific code that performs a /// EmitTargetCodeForMemcpy - Emit target-specific code that performs a
/// memcpy. This can be used by targets to provide code sequences for cases /// memcpy. This can be used by targets to provide code sequences for cases

View File

@ -991,6 +991,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
assert(isTypeLegal(Op.getValueType()) && assert(isTypeLegal(Op.getValueType()) &&
"Caller should expand or promote operands that are not legal!"); "Caller should expand or promote operands that are not legal!");
SDNode *Node = Op.getNode(); SDNode *Node = Op.getNode();
DebugLoc dl = Node->getDebugLoc();
// If this operation defines any values that cannot be represented in a // If this operation defines any values that cannot be represented in a
// register on this target, make sure to expand or promote them. // register on this target, make sure to expand or promote them.
@ -4323,7 +4324,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
TLI.LowerCallTo(Tmp1, Type::VoidTy, TLI.LowerCallTo(Tmp1, Type::VoidTy,
false, false, false, false, CallingConv::C, false, false, false, false, false, CallingConv::C, false,
DAG.getExternalSymbol("abort", TLI.getPointerTy()), DAG.getExternalSymbol("abort", TLI.getPointerTy()),
Args, DAG); Args, DAG, dl);
Result = CallResult.second; Result = CallResult.second;
break; break;
} }
@ -5791,7 +5792,8 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
const Type *RetTy = Node->getValueType(0).getTypeForMVT(); const Type *RetTy = Node->getValueType(0).getTypeForMVT();
std::pair<SDValue,SDValue> CallInfo = std::pair<SDValue,SDValue> CallInfo =
TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false, TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false,
CallingConv::C, false, Callee, Args, DAG); CallingConv::C, false, Callee, Args, DAG,
Node->getDebugLoc());
// Legalize the call sequence, starting with the chain. This will advance // Legalize the call sequence, starting with the chain. This will advance
// the LastCALLSEQ_END to the legalized version of the CALLSEQ_END node that // the LastCALLSEQ_END to the legalized version of the CALLSEQ_END node that

View File

@ -987,9 +987,11 @@ SDValue DAGTypeLegalizer::MakeLibCall(RTLIB::Libcall LC, MVT RetVT,
TLI.getPointerTy()); TLI.getPointerTy());
const Type *RetTy = RetVT.getTypeForMVT(); const Type *RetTy = RetVT.getTypeForMVT();
// FIXME pass in debug loc
std::pair<SDValue,SDValue> CallInfo = std::pair<SDValue,SDValue> CallInfo =
TLI.LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false, TLI.LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
false, CallingConv::C, false, Callee, Args, DAG); false, CallingConv::C, false, Callee, Args, DAG,
DebugLoc::getUnknownLoc());
return CallInfo.first; return CallInfo.first;
} }

View File

@ -3285,11 +3285,12 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, SDValue Dst,
Entry.Node = Dst; Args.push_back(Entry); Entry.Node = Dst; Args.push_back(Entry);
Entry.Node = Src; Args.push_back(Entry); Entry.Node = Src; Args.push_back(Entry);
Entry.Node = Size; Args.push_back(Entry); Entry.Node = Size; Args.push_back(Entry);
// FIXME: pass in DebugLoc
std::pair<SDValue,SDValue> CallResult = std::pair<SDValue,SDValue> CallResult =
TLI.LowerCallTo(Chain, Type::VoidTy, TLI.LowerCallTo(Chain, Type::VoidTy,
false, false, false, false, CallingConv::C, false, false, false, false, false, CallingConv::C, false,
getExternalSymbol("memcpy", TLI.getPointerTy()), getExternalSymbol("memcpy", TLI.getPointerTy()),
Args, *this); Args, *this, DebugLoc::getUnknownLoc());
return CallResult.second; return CallResult.second;
} }
@ -3330,11 +3331,12 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, SDValue Dst,
Entry.Node = Dst; Args.push_back(Entry); Entry.Node = Dst; Args.push_back(Entry);
Entry.Node = Src; Args.push_back(Entry); Entry.Node = Src; Args.push_back(Entry);
Entry.Node = Size; Args.push_back(Entry); Entry.Node = Size; Args.push_back(Entry);
// FIXME: pass in DebugLoc
std::pair<SDValue,SDValue> CallResult = std::pair<SDValue,SDValue> CallResult =
TLI.LowerCallTo(Chain, Type::VoidTy, TLI.LowerCallTo(Chain, Type::VoidTy,
false, false, false, false, CallingConv::C, false, false, false, false, false, CallingConv::C, false,
getExternalSymbol("memmove", TLI.getPointerTy()), getExternalSymbol("memmove", TLI.getPointerTy()),
Args, *this); Args, *this, DebugLoc::getUnknownLoc());
return CallResult.second; return CallResult.second;
} }
@ -3381,11 +3383,12 @@ SDValue SelectionDAG::getMemset(SDValue Chain, SDValue Dst,
Args.push_back(Entry); Args.push_back(Entry);
Entry.Node = Size; Entry.Ty = IntPtrTy; Entry.isSExt = false; Entry.Node = Size; Entry.Ty = IntPtrTy; Entry.isSExt = false;
Args.push_back(Entry); Args.push_back(Entry);
// FIXME: pass in DebugLoc
std::pair<SDValue,SDValue> CallResult = std::pair<SDValue,SDValue> CallResult =
TLI.LowerCallTo(Chain, Type::VoidTy, TLI.LowerCallTo(Chain, Type::VoidTy,
false, false, false, false, CallingConv::C, false, false, false, false, false, CallingConv::C, false,
getExternalSymbol("memset", TLI.getPointerTy()), getExternalSymbol("memset", TLI.getPointerTy()),
Args, *this); Args, *this, DebugLoc::getUnknownLoc());
return CallResult.second; return CallResult.second;
} }

View File

@ -4344,7 +4344,7 @@ void SelectionDAGLowering::LowerCallTo(CallSite CS, SDValue Callee,
CS.paramHasAttr(0, Attribute::InReg), CS.paramHasAttr(0, Attribute::InReg),
CS.getCallingConv(), CS.getCallingConv(),
IsTailCall && PerformTailCallOpt, IsTailCall && PerformTailCallOpt,
Callee, Args, DAG); Callee, Args, DAG, DAG.getCurDebugLoc());
if (CS.getType() != Type::VoidTy) if (CS.getType() != Type::VoidTy)
setValue(CS.getInstruction(), Result.first); setValue(CS.getInstruction(), Result.first);
DAG.setRoot(Result.second); DAG.setRoot(Result.second);
@ -5357,7 +5357,7 @@ void SelectionDAGLowering::visitMalloc(MallocInst &I) {
TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, false, TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, false,
CallingConv::C, PerformTailCallOpt, CallingConv::C, PerformTailCallOpt,
DAG.getExternalSymbol("malloc", IntPtr), DAG.getExternalSymbol("malloc", IntPtr),
Args, DAG); Args, DAG, DAG.getCurDebugLoc());
setValue(&I, Result.first); // Pointers always fit in registers setValue(&I, Result.first); // Pointers always fit in registers
DAG.setRoot(Result.second); DAG.setRoot(Result.second);
} }
@ -5372,7 +5372,8 @@ void SelectionDAGLowering::visitFree(FreeInst &I) {
std::pair<SDValue,SDValue> Result = std::pair<SDValue,SDValue> Result =
TLI.LowerCallTo(getRoot(), Type::VoidTy, false, false, false, false, TLI.LowerCallTo(getRoot(), Type::VoidTy, false, false, false, false,
CallingConv::C, PerformTailCallOpt, CallingConv::C, PerformTailCallOpt,
DAG.getExternalSymbol("free", IntPtr), Args, DAG); DAG.getExternalSymbol("free", IntPtr), Args, DAG,
DAG.getCurDebugLoc());
DAG.setRoot(Result.second); DAG.setRoot(Result.second);
} }
@ -5412,7 +5413,8 @@ void SelectionDAGLowering::visitVACopy(CallInst &I) {
/// targets are migrated to using FORMAL_ARGUMENTS, this hook should be /// targets are migrated to using FORMAL_ARGUMENTS, this hook should be
/// integrated into SDISel. /// integrated into SDISel.
void TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG, void TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
SmallVectorImpl<SDValue> &ArgValues) { SmallVectorImpl<SDValue> &ArgValues,
DebugLoc dl) {
// Add CC# and isVararg as operands to the FORMAL_ARGUMENTS node. // Add CC# and isVararg as operands to the FORMAL_ARGUMENTS node.
SmallVector<SDValue, 3+16> Ops; SmallVector<SDValue, 3+16> Ops;
Ops.push_back(DAG.getRoot()); Ops.push_back(DAG.getRoot());
@ -5477,7 +5479,7 @@ void TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
RetVals.push_back(MVT::Other); RetVals.push_back(MVT::Other);
// Create the node. // Create the node.
SDNode *Result = DAG.getNode(ISD::FORMAL_ARGUMENTS, DAG.getCurDebugLoc(), SDNode *Result = DAG.getNode(ISD::FORMAL_ARGUMENTS, dl,
DAG.getVTList(&RetVals[0], RetVals.size()), DAG.getVTList(&RetVals[0], RetVals.size()),
&Ops[0], Ops.size()).getNode(); &Ops[0], Ops.size()).getNode();
@ -5545,7 +5547,7 @@ TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
bool isInreg, bool isInreg,
unsigned CallingConv, bool isTailCall, unsigned CallingConv, bool isTailCall,
SDValue Callee, SDValue Callee,
ArgListTy &Args, SelectionDAG &DAG) { ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl) {
assert((!isTailCall || PerformTailCallOpt) && assert((!isTailCall || PerformTailCallOpt) &&
"isTailCall set when tail-call optimizations are disabled!"); "isTailCall set when tail-call optimizations are disabled!");
@ -5636,7 +5638,7 @@ TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
LoweredRetTys.push_back(MVT::Other); // Always has a chain. LoweredRetTys.push_back(MVT::Other); // Always has a chain.
// Create the CALL node. // Create the CALL node.
SDValue Res = DAG.getCall(CallingConv, DAG.getCurDebugLoc(), SDValue Res = DAG.getCall(CallingConv, dl,
isVarArg, isTailCall, isInreg, isVarArg, isTailCall, isInreg,
DAG.getVTList(&LoweredRetTys[0], DAG.getVTList(&LoweredRetTys[0],
LoweredRetTys.size()), LoweredRetTys.size()),
@ -5668,7 +5670,7 @@ TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
AssertOp); AssertOp);
ReturnValues.push_back(ReturnValue); ReturnValues.push_back(ReturnValue);
} }
Res = DAG.getNode(ISD::MERGE_VALUES, DAG.getCurDebugLoc(), Res = DAG.getNode(ISD::MERGE_VALUES, dl,
DAG.getVTList(&RetTys[0], RetTys.size()), DAG.getVTList(&RetTys[0], RetTys.size()),
&ReturnValues[0], ReturnValues.size()); &ReturnValues[0], ReturnValues.size());
} }
@ -5712,7 +5714,7 @@ LowerArguments(BasicBlock *LLVMBB) {
Function &F = *LLVMBB->getParent(); Function &F = *LLVMBB->getParent();
SDValue OldRoot = SDL->DAG.getRoot(); SDValue OldRoot = SDL->DAG.getRoot();
SmallVector<SDValue, 16> Args; SmallVector<SDValue, 16> Args;
TLI.LowerArguments(F, SDL->DAG, Args); TLI.LowerArguments(F, SDL->DAG, Args, SDL->DAG.getCurDebugLoc());
unsigned a = 0; unsigned a = 0;
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end();

View File

@ -740,10 +740,12 @@ ARMTargetLowering::LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
Entry.Node = Argument; Entry.Node = Argument;
Entry.Ty = (const Type *) Type::Int32Ty; Entry.Ty = (const Type *) Type::Int32Ty;
Args.push_back(Entry); Args.push_back(Entry);
// FIXME: is there useful debug info available here?
std::pair<SDValue, SDValue> CallResult = std::pair<SDValue, SDValue> CallResult =
LowerCallTo(Chain, (const Type *) Type::Int32Ty, false, false, false, false, LowerCallTo(Chain, (const Type *) Type::Int32Ty, false, false, false, false,
CallingConv::C, false, CallingConv::C, false,
DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG); DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG,
DebugLoc::getUnknownLoc());
return CallResult.first; return CallResult.first;
} }

View File

@ -356,7 +356,8 @@ AlphaTargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
bool RetSExt, bool RetZExt, bool isVarArg, bool RetSExt, bool RetZExt, bool isVarArg,
bool isInreg, unsigned CallingConv, bool isInreg, unsigned CallingConv,
bool isTailCall, SDValue Callee, bool isTailCall, SDValue Callee,
ArgListTy &Args, SelectionDAG &DAG) { ArgListTy &Args, SelectionDAG &DAG,
DebugLoc dl) {
int NumBytes = 0; int NumBytes = 0;
if (Args.size() > 6) if (Args.size() > 6)
NumBytes = (Args.size() - 6) * 8; NumBytes = (Args.size() - 6) * 8;
@ -374,11 +375,13 @@ AlphaTargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
// Promote the integer to 64 bits. If the input type is signed use a // Promote the integer to 64 bits. If the input type is signed use a
// sign extend, otherwise use a zero extend. // sign extend, otherwise use a zero extend.
if (Args[i].isSExt) if (Args[i].isSExt)
Args[i].Node = DAG.getNode(ISD::SIGN_EXTEND, MVT::i64, Args[i].Node); Args[i].Node = DAG.getNode(ISD::SIGN_EXTEND, dl,
MVT::i64, Args[i].Node);
else if (Args[i].isZExt) else if (Args[i].isZExt)
Args[i].Node = DAG.getNode(ISD::ZERO_EXTEND, MVT::i64, Args[i].Node); Args[i].Node = DAG.getNode(ISD::ZERO_EXTEND, dl,
MVT::i64, Args[i].Node);
else else
Args[i].Node = DAG.getNode(ISD::ANY_EXTEND, MVT::i64, Args[i].Node); Args[i].Node = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i64, Args[i].Node);
break; break;
case MVT::i64: case MVT::i64:
case MVT::f64: case MVT::f64:
@ -402,7 +405,8 @@ AlphaTargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
Ops.push_back(Chain); Ops.push_back(Chain);
Ops.push_back(Callee); Ops.push_back(Callee);
Ops.insert(Ops.end(), args_to_use.begin(), args_to_use.end()); Ops.insert(Ops.end(), args_to_use.begin(), args_to_use.end());
SDValue TheCall = DAG.getNode(AlphaISD::CALL, RetVals, &Ops[0], Ops.size()); SDValue TheCall = DAG.getNode(AlphaISD::CALL, dl,
RetVals, &Ops[0], Ops.size());
Chain = TheCall.getValue(RetTyVT != MVT::isVoid); Chain = TheCall.getValue(RetTyVT != MVT::isVoid);
Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, true), Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, true),
DAG.getIntPtrConstant(0, true), SDValue()); DAG.getIntPtrConstant(0, true), SDValue());
@ -416,10 +420,10 @@ AlphaTargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
AssertKind = ISD::AssertZext; AssertKind = ISD::AssertZext;
if (AssertKind != ISD::DELETED_NODE) if (AssertKind != ISD::DELETED_NODE)
RetVal = DAG.getNode(AssertKind, MVT::i64, RetVal, RetVal = DAG.getNode(AssertKind, dl, MVT::i64, RetVal,
DAG.getValueType(RetTyVT)); DAG.getValueType(RetTyVT));
RetVal = DAG.getNode(ISD::TRUNCATE, RetTyVT, RetVal); RetVal = DAG.getNode(ISD::TRUNCATE, dl, RetTyVT, RetVal);
} }
return std::make_pair(RetVal, Chain); return std::make_pair(RetVal, Chain);

View File

@ -87,7 +87,8 @@ namespace llvm {
virtual std::pair<SDValue, SDValue> virtual std::pair<SDValue, SDValue>
LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt, LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt,
bool isVarArg, bool isInreg, unsigned CC, bool isTailCall, bool isVarArg, bool isInreg, unsigned CC, bool isTailCall,
SDValue Callee, ArgListTy &Args, SelectionDAG &DAG); SDValue Callee, ArgListTy &Args, SelectionDAG &DAG,
DebugLoc dl);
ConstraintType getConstraintType(const std::string &Constraint) const; ConstraintType getConstraintType(const std::string &Constraint) const;

View File

@ -113,7 +113,8 @@ namespace {
const Type *RetTy = Op.getNode()->getValueType(0).getTypeForMVT(); const Type *RetTy = Op.getNode()->getValueType(0).getTypeForMVT();
std::pair<SDValue, SDValue> CallInfo = std::pair<SDValue, SDValue> CallInfo =
TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false, TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false,
CallingConv::C, false, Callee, Args, DAG); CallingConv::C, false, Callee, Args, DAG,
Op.getNode()->getDebugLoc());
return CallInfo.first; return CallInfo.first;
} }

View File

@ -145,7 +145,8 @@ MVT IA64TargetLowering::getSetCCResultType(MVT VT) const {
} }
void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG, void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
SmallVectorImpl<SDValue> &ArgValues) { SmallVectorImpl<SDValue> &ArgValues,
DebugLoc dl) {
// //
// add beautiful description of IA64 stack frame format // add beautiful description of IA64 stack frame format
// here (from intel 24535803.pdf most likely) // here (from intel 24535803.pdf most likely)
@ -199,7 +200,7 @@ void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
argt = newroot = DAG.getCopyFromReg(DAG.getRoot(), argVreg[count], argt = newroot = DAG.getCopyFromReg(DAG.getRoot(), argVreg[count],
MVT::f64); MVT::f64);
if (I->getType() == Type::FloatTy) if (I->getType() == Type::FloatTy)
argt = DAG.getNode(ISD::FP_ROUND, MVT::f32, argt, argt = DAG.getNode(ISD::FP_ROUND, dl, MVT::f32, argt,
DAG.getIntPtrConstant(0)); DAG.getIntPtrConstant(0));
break; break;
case MVT::i1: // NOTE: as far as C abi stuff goes, case MVT::i1: // NOTE: as far as C abi stuff goes,
@ -218,7 +219,7 @@ void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
argt = newroot = argt = newroot =
DAG.getCopyFromReg(DAG.getRoot(), argVreg[count], MVT::i64); DAG.getCopyFromReg(DAG.getRoot(), argVreg[count], MVT::i64);
if ( getValueType(I->getType()) != MVT::i64) if ( getValueType(I->getType()) != MVT::i64)
argt = DAG.getNode(ISD::TRUNCATE, getValueType(I->getType()), argt = DAG.getNode(ISD::TRUNCATE, dl, getValueType(I->getType()),
newroot); newroot);
break; break;
} }
@ -230,7 +231,7 @@ void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
// Create the SelectionDAG nodes corresponding to a load // Create the SelectionDAG nodes corresponding to a load
//from this parameter //from this parameter
SDValue FIN = DAG.getFrameIndex(FI, MVT::i64); SDValue FIN = DAG.getFrameIndex(FI, MVT::i64);
argt = newroot = DAG.getLoad(getValueType(I->getType()), argt = newroot = DAG.getLoad(getValueType(I->getType()), dl,
DAG.getEntryNode(), FIN, NULL, 0); DAG.getEntryNode(), FIN, NULL, 0);
} }
++count; ++count;
@ -307,7 +308,8 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
bool RetSExt, bool RetZExt, bool isVarArg, bool RetSExt, bool RetZExt, bool isVarArg,
bool isInreg, unsigned CallingConv, bool isInreg, unsigned CallingConv,
bool isTailCall, SDValue Callee, bool isTailCall, SDValue Callee,
ArgListTy &Args, SelectionDAG &DAG) { ArgListTy &Args, SelectionDAG &DAG,
DebugLoc dl) {
MachineFunction &MF = DAG.getMachineFunction(); MachineFunction &MF = DAG.getMachineFunction();
@ -360,7 +362,7 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
ExtendKind = ISD::SIGN_EXTEND; ExtendKind = ISD::SIGN_EXTEND;
else if (Args[i].isZExt) else if (Args[i].isZExt)
ExtendKind = ISD::ZERO_EXTEND; ExtendKind = ISD::ZERO_EXTEND;
Val = DAG.getNode(ExtendKind, MVT::i64, Val); Val = DAG.getNode(ExtendKind, dl, MVT::i64, Val);
// XXX: fall through // XXX: fall through
} }
case MVT::i64: case MVT::i64:
@ -373,7 +375,7 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
break; break;
case MVT::f32: case MVT::f32:
//promote to 64-bits //promote to 64-bits
Val = DAG.getNode(ISD::FP_EXTEND, MVT::f64, Val); Val = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f64, Val);
// XXX: fall through // XXX: fall through
case MVT::f64: case MVT::f64:
if(RegValuesToPass.size() >= 8) { if(RegValuesToPass.size() >= 8) {
@ -392,19 +394,21 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
StackPtr = DAG.getRegister(IA64::r12, MVT::i64); StackPtr = DAG.getRegister(IA64::r12, MVT::i64);
} }
SDValue PtrOff = DAG.getConstant(ArgOffset, getPointerTy()); SDValue PtrOff = DAG.getConstant(ArgOffset, getPointerTy());
PtrOff = DAG.getNode(ISD::ADD, MVT::i64, StackPtr, PtrOff); PtrOff = DAG.getNode(ISD::ADD, dl, MVT::i64, StackPtr, PtrOff);
Stores.push_back(DAG.getStore(Chain, ValToStore, PtrOff, NULL, 0)); Stores.push_back(DAG.getStore(Chain, dl, ValToStore, PtrOff, NULL, 0));
ArgOffset += ObjSize; ArgOffset += ObjSize;
} }
if(ValToConvert.getNode()) { if(ValToConvert.getNode()) {
Converts.push_back(DAG.getNode(IA64ISD::GETFD, MVT::i64, ValToConvert)); Converts.push_back(DAG.getNode(IA64ISD::GETFD, dl,
MVT::i64, ValToConvert));
} }
} }
// Emit all stores, make sure they occur before any copies into physregs. // Emit all stores, make sure they occur before any copies into physregs.
if (!Stores.empty()) if (!Stores.empty())
Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &Stores[0],Stores.size()); Chain = DAG.getNode(ISD::TokenFactor, dl,
MVT::Other, &Stores[0],Stores.size());
static const unsigned IntArgRegs[] = { static const unsigned IntArgRegs[] = {
IA64::out0, IA64::out1, IA64::out2, IA64::out3, IA64::out0, IA64::out1, IA64::out2, IA64::out3,
@ -477,7 +481,7 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
assert(0 && "this should never happen!\n"); assert(0 && "this should never happen!\n");
// to make way for a hack: // to make way for a hack:
Chain = DAG.getNode(IA64ISD::BRCALL, NodeTys, Chain = DAG.getNode(IA64ISD::BRCALL, dl, NodeTys,
&CallOperands[0], CallOperands.size()); &CallOperands[0], CallOperands.size());
InFlag = Chain.getValue(1); InFlag = Chain.getValue(1);
@ -508,7 +512,7 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
InFlag = zeroReg.getValue(2); InFlag = zeroReg.getValue(2);
Chain = zeroReg.getValue(1); Chain = zeroReg.getValue(1);
RetVal = DAG.getSetCC(MVT::i1, boolInR8, zeroReg, ISD::SETNE); RetVal = DAG.getSetCC(dl, MVT::i1, boolInR8, zeroReg, ISD::SETNE);
break; break;
} }
case MVT::i8: case MVT::i8:
@ -520,9 +524,9 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
// keep track of whether it is sign or zero extended (todo: bools?) // keep track of whether it is sign or zero extended (todo: bools?)
/* XXX /* XXX
RetVal = DAG.getNode(RetTy->isSigned() ? ISD::AssertSext :ISD::AssertZext, RetVal = DAG.getNode(RetTy->isSigned() ? ISD::AssertSext :ISD::AssertZext,
MVT::i64, RetVal, DAG.getValueType(RetTyVT)); dl, MVT::i64, RetVal, DAG.getValueType(RetTyVT));
*/ */
RetVal = DAG.getNode(ISD::TRUNCATE, RetTyVT, RetVal); RetVal = DAG.getNode(ISD::TRUNCATE, dl, RetTyVT, RetVal);
break; break;
case MVT::i64: case MVT::i64:
RetVal = DAG.getCopyFromReg(Chain, IA64::r8, MVT::i64, InFlag); RetVal = DAG.getCopyFromReg(Chain, IA64::r8, MVT::i64, InFlag);
@ -532,7 +536,7 @@ IA64TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
case MVT::f32: case MVT::f32:
RetVal = DAG.getCopyFromReg(Chain, IA64::F8, MVT::f64, InFlag); RetVal = DAG.getCopyFromReg(Chain, IA64::F8, MVT::f64, InFlag);
Chain = RetVal.getValue(1); Chain = RetVal.getValue(1);
RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal, RetVal = DAG.getNode(ISD::FP_ROUND, dl, MVT::f32, RetVal,
DAG.getIntPtrConstant(0)); DAG.getIntPtrConstant(0));
break; break;
case MVT::f64: case MVT::f64:

View File

@ -54,7 +54,8 @@ namespace llvm {
/// LowerArguments - This hook must be implemented to indicate how we should /// LowerArguments - This hook must be implemented to indicate how we should
/// lower the arguments for the specified function, into the specified DAG. /// lower the arguments for the specified function, into the specified DAG.
virtual void LowerArguments(Function &F, SelectionDAG &DAG, virtual void LowerArguments(Function &F, SelectionDAG &DAG,
SmallVectorImpl<SDValue> &ArgValues); SmallVectorImpl<SDValue> &ArgValues,
DebugLoc dl);
/// LowerCallTo - This hook lowers an abstract call to a function into an /// LowerCallTo - This hook lowers an abstract call to a function into an
/// actual call. /// actual call.
@ -62,7 +63,8 @@ namespace llvm {
LowerCallTo(SDValue Chain, const Type *RetTy, LowerCallTo(SDValue Chain, const Type *RetTy,
bool RetSExt, bool RetZExt, bool isVarArg, bool isInreg, bool RetSExt, bool RetZExt, bool isVarArg, bool isInreg,
unsigned CC, bool isTailCall, unsigned CC, bool isTailCall,
SDValue Callee, ArgListTy &Args, SelectionDAG &DAG); SDValue Callee, ArgListTy &Args, SelectionDAG &DAG,
DebugLoc dl);
/// LowerOperation - for custom lowering specific ops /// LowerOperation - for custom lowering specific ops
/// (currently, only "ret void") /// (currently, only "ret void")

View File

@ -172,7 +172,7 @@ SDValue
PIC16TargetLowering::MakePIC16Libcall(PIC16ISD::PIC16Libcall Call, PIC16TargetLowering::MakePIC16Libcall(PIC16ISD::PIC16Libcall Call,
MVT RetVT, const SDValue *Ops, MVT RetVT, const SDValue *Ops,
unsigned NumOps, bool isSigned, unsigned NumOps, bool isSigned,
SelectionDAG &DAG) { SelectionDAG &DAG, DebugLoc dl) {
TargetLowering::ArgListTy Args; TargetLowering::ArgListTy Args;
Args.reserve(NumOps); Args.reserve(NumOps);
@ -190,7 +190,7 @@ PIC16TargetLowering::MakePIC16Libcall(PIC16ISD::PIC16Libcall Call,
const Type *RetTy = RetVT.getTypeForMVT(); const Type *RetTy = RetVT.getTypeForMVT();
std::pair<SDValue,SDValue> CallInfo = std::pair<SDValue,SDValue> CallInfo =
LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false, LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
false, CallingConv::C, false, Callee, Args, DAG); false, CallingConv::C, false, Callee, Args, DAG, dl);
return CallInfo.first; return CallInfo.first;
} }
@ -758,7 +758,8 @@ SDValue PIC16TargetLowering::LowerShift(SDValue Op, SelectionDAG &DAG) {
SmallVector<SDValue, 2> Ops(2); SmallVector<SDValue, 2> Ops(2);
Ops[0] = Value; Ops[0] = Value;
Ops[1] = Amt; Ops[1] = Amt;
SDValue Call = MakePIC16Libcall(CallCode, N->getValueType(0), &Ops[0], 2, true, DAG); SDValue Call = MakePIC16Libcall(CallCode, N->getValueType(0), &Ops[0], 2,
true, DAG, N->getDebugLoc());
return Call; return Call;
} }

View File

@ -168,7 +168,7 @@ namespace llvm {
// Make PIC16 Libcall // Make PIC16 Libcall
SDValue MakePIC16Libcall(PIC16ISD::PIC16Libcall Call, MVT RetVT, SDValue MakePIC16Libcall(PIC16ISD::PIC16Libcall Call, MVT RetVT,
const SDValue *Ops, unsigned NumOps, bool isSigned, const SDValue *Ops, unsigned NumOps, bool isSigned,
SelectionDAG &DAG); SelectionDAG &DAG, DebugLoc dl);
// Check if operation has a direct load operand. // Check if operation has a direct load operand.
inline bool isDirectLoad(const SDValue Op); inline bool isDirectLoad(const SDValue Op);

View File

@ -1229,6 +1229,7 @@ SDValue PPCTargetLowering::LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) {
SDValue Trmp = Op.getOperand(1); // trampoline SDValue Trmp = Op.getOperand(1); // trampoline
SDValue FPtr = Op.getOperand(2); // nested function SDValue FPtr = Op.getOperand(2); // nested function
SDValue Nest = Op.getOperand(3); // 'nest' parameter value SDValue Nest = Op.getOperand(3); // 'nest' parameter value
DebugLoc dl = Op.getNode()->getDebugLoc();
MVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); MVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
bool isPPC64 = (PtrVT == MVT::i64); bool isPPC64 = (PtrVT == MVT::i64);
@ -1254,7 +1255,7 @@ SDValue PPCTargetLowering::LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) {
LowerCallTo(Chain, Op.getValueType().getTypeForMVT(), false, false, LowerCallTo(Chain, Op.getValueType().getTypeForMVT(), false, false,
false, false, CallingConv::C, false, false, false, CallingConv::C, false,
DAG.getExternalSymbol("__trampoline_setup", PtrVT), DAG.getExternalSymbol("__trampoline_setup", PtrVT),
Args, DAG); Args, DAG, dl);
SDValue Ops[] = SDValue Ops[] =
{ CallResult.first, CallResult.second }; { CallResult.first, CallResult.second };

View File

@ -77,7 +77,8 @@ static SDValue LowerRET(SDValue Op, SelectionDAG &DAG) {
/// in FP registers for fastcc functions. /// in FP registers for fastcc functions.
void void
SparcTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG, SparcTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
SmallVectorImpl<SDValue> &ArgValues) { SmallVectorImpl<SDValue> &ArgValues,
DebugLoc dl) {
MachineFunction &MF = DAG.getMachineFunction(); MachineFunction &MF = DAG.getMachineFunction();
MachineRegisterInfo &RegInfo = MF.getRegInfo(); MachineRegisterInfo &RegInfo = MF.getRegInfo();

View File

@ -58,7 +58,8 @@ namespace llvm {
unsigned Depth = 0) const; unsigned Depth = 0) const;
virtual void LowerArguments(Function &F, SelectionDAG &DAG, virtual void LowerArguments(Function &F, SelectionDAG &DAG,
SmallVectorImpl<SDValue> &ArgValues); SmallVectorImpl<SDValue> &ArgValues,
DebugLoc dl);
virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
MachineBasicBlock *MBB); MachineBasicBlock *MBB);

View File

@ -5532,10 +5532,12 @@ X86TargetLowering::EmitTargetCodeForMemset(SelectionDAG &DAG,
Args.push_back(Entry); Args.push_back(Entry);
Entry.Node = Size; Entry.Node = Size;
Args.push_back(Entry); Args.push_back(Entry);
// FIXME provide DebugLoc info
std::pair<SDValue,SDValue> CallResult = std::pair<SDValue,SDValue> CallResult =
LowerCallTo(Chain, Type::VoidTy, false, false, false, false, LowerCallTo(Chain, Type::VoidTy, false, false, false, false,
CallingConv::C, false, CallingConv::C, false,
DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG); DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG,
DebugLoc::getUnknownLoc());
return CallResult.second; return CallResult.second;
} }