summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-10 00:25:44 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2017-03-10 00:25:44 +0000
commitd22b84b9d07e80eacbed8968278275aaa237bb20 (patch)
tree6742400eb53526905a39308877b944735198e5d7 /llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
parent4ec6d5abed9ecb760a53a97ce0468378ec0a8ce2 (diff)
downloadbcm5719-llvm-d22b84b9d07e80eacbed8968278275aaa237bb20.tar.gz
bcm5719-llvm-d22b84b9d07e80eacbed8968278275aaa237bb20.zip
[GlobalISel] Use ImmutableCallSite instead of templates. NFC.
ImmutableCallSite abstracts away CallInst and InvokeInst. Use it! llvm-svn: 297426
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/CallLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CallLowering.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 90427b27cd0..e45ae4a77f2 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -23,49 +23,38 @@
using namespace llvm;
-template<typename CallInstTy>
bool CallLowering::lowerCall(
- MachineIRBuilder &MIRBuilder, const CallInstTy &CI, unsigned ResReg,
+ MachineIRBuilder &MIRBuilder, ImmutableCallSite CS, unsigned ResReg,
ArrayRef<unsigned> ArgRegs, std::function<unsigned()> GetCalleeReg) const {
- auto &DL = CI.getParent()->getParent()->getParent()->getDataLayout();
+ auto &DL = CS.getParent()->getParent()->getParent()->getDataLayout();
// First step is to marshall all the function's parameters into the correct
// physregs and memory locations. Gather the sequence of argument types that
// we'll pass to the assigner function.
SmallVector<ArgInfo, 8> OrigArgs;
unsigned i = 0;
- unsigned NumFixedArgs = CI.getFunctionType()->getNumParams();
- for (auto &Arg : CI.arg_operands()) {
+ unsigned NumFixedArgs = CS.getFunctionType()->getNumParams();
+ for (auto &Arg : CS.args()) {
ArgInfo OrigArg{ArgRegs[i], Arg->getType(), ISD::ArgFlagsTy{},
i < NumFixedArgs};
- setArgFlags(OrigArg, i + 1, DL, CI);
+ setArgFlags(OrigArg, i + 1, DL, CS);
OrigArgs.push_back(OrigArg);
++i;
}
MachineOperand Callee = MachineOperand::CreateImm(0);
- if (Function *F = CI.getCalledFunction())
+ if (const Function *F = CS.getCalledFunction())
Callee = MachineOperand::CreateGA(F, 0);
else
Callee = MachineOperand::CreateReg(GetCalleeReg(), false);
- ArgInfo OrigRet{ResReg, CI.getType(), ISD::ArgFlagsTy{}};
+ ArgInfo OrigRet{ResReg, CS.getType(), ISD::ArgFlagsTy{}};
if (!OrigRet.Ty->isVoidTy())
- setArgFlags(OrigRet, AttributeSet::ReturnIndex, DL, CI);
+ setArgFlags(OrigRet, AttributeSet::ReturnIndex, DL, CS);
return lowerCall(MIRBuilder, Callee, OrigRet, OrigArgs);
}
-template bool
-CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, const CallInst &CI,
- unsigned ResReg, ArrayRef<unsigned> ArgRegs,
- std::function<unsigned()> GetCalleeReg) const;
-
-template bool
-CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, const InvokeInst &CI,
- unsigned ResReg, ArrayRef<unsigned> ArgRegs,
- std::function<unsigned()> GetCalleeReg) const;
-
template <typename FuncInfoTy>
void CallLowering::setArgFlags(CallLowering::ArgInfo &Arg, unsigned OpIdx,
const DataLayout &DL,
OpenPOWER on IntegriCloud