GlobalISel: pass Function to lowerFormalArguments directly (NFC).

The only implementation that exists immediately looks it up anyway, and the
information is needed to handle various parameter attributes (stored on the
function itself).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tim Northover 2016-09-21 12:57:35 +00:00
parent d5fca758fa
commit d79f714b0b
6 changed files with 14 additions and 19 deletions

View File

@ -62,10 +62,9 @@ class CallLowering {
/// lowering.
///
/// \return True if the lowering succeeded, false otherwise.
virtual bool
lowerFormalArguments(MachineIRBuilder &MIRBuilder,
const Function::ArgumentListType &Args,
ArrayRef<unsigned> VRegs) const {
virtual bool lowerFormalArguments(MachineIRBuilder &MIRBuilder,
const Function &F,
ArrayRef<unsigned> VRegs) const {
return false;
}

View File

@ -556,8 +556,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &MF) {
SmallVector<unsigned, 8> VRegArgs;
for (const Argument &Arg: F.args())
VRegArgs.push_back(getOrCreateVReg(Arg));
bool Succeeded =
CLI->lowerFormalArguments(MIRBuilder, F.getArgumentList(), VRegArgs);
bool Succeeded = CLI->lowerFormalArguments(MIRBuilder, F, VRegArgs);
if (!Succeeded) {
if (!TPC->isGlobalISelAbortEnabled()) {
MIRBuilder.getMF().getProperties().set(

View File

@ -152,13 +152,13 @@ bool AArch64CallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
return true;
}
bool AArch64CallLowering::lowerFormalArguments(
MachineIRBuilder &MIRBuilder, const Function::ArgumentListType &Args,
ArrayRef<unsigned> VRegs) const {
bool AArch64CallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
const Function &F,
ArrayRef<unsigned> VRegs) const {
auto &Args = F.getArgumentList();
MachineFunction &MF = MIRBuilder.getMF();
MachineBasicBlock &MBB = MIRBuilder.getMBB();
MachineRegisterInfo &MRI = MF.getRegInfo();
const Function &F = *MF.getFunction();
auto &DL = F.getParent()->getDataLayout();
SmallVector<MachineInstr *, 8> Seqs;

View File

@ -30,8 +30,7 @@ class AArch64CallLowering: public CallLowering {
bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
unsigned VReg) const override;
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder,
const Function::ArgumentListType &Args,
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
ArrayRef<unsigned> VRegs) const override;
bool lowerCall(MachineIRBuilder &MIRBuilder, const MachineOperand &Callee,

View File

@ -34,9 +34,9 @@ bool AMDGPUCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
return true;
}
bool AMDGPUCallLowering::lowerFormalArguments(
MachineIRBuilder &MIRBuilder, const Function::ArgumentListType &Args,
ArrayRef<unsigned> VRegs) const {
bool AMDGPUCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
const Function &F,
ArrayRef<unsigned> VRegs) const {
// TODO: Implement once there are generic loads/stores.
return true;
}

View File

@ -27,10 +27,8 @@ class AMDGPUCallLowering: public CallLowering {
bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
unsigned VReg) const override;
bool
lowerFormalArguments(MachineIRBuilder &MIRBuilder,
const Function::ArgumentListType &Args,
ArrayRef<unsigned> VRegs) const override;
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
ArrayRef<unsigned> VRegs) const override;
};
} // End of namespace llvm;
#endif