From 862758ec14741db27ef4594b1ba26ce5825de8a6 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Wed, 21 Sep 2016 12:57:35 +0000 Subject: [PATCH] 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). llvm-svn: 282068 --- llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h | 7 +++---- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 3 +-- llvm/lib/Target/AArch64/AArch64CallLowering.cpp | 8 ++++---- llvm/lib/Target/AArch64/AArch64CallLowering.h | 3 +-- llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp | 6 +++--- llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h | 6 ++---- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h index 62bd0f4..6df0e9e 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h @@ -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 VRegs) const { + virtual bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, + const Function &F, + ArrayRef VRegs) const { return false; } diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 4d4a696..155a39a 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -556,8 +556,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &MF) { SmallVector 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( diff --git a/llvm/lib/Target/AArch64/AArch64CallLowering.cpp b/llvm/lib/Target/AArch64/AArch64CallLowering.cpp index 6e31813..0a3b911 100644 --- a/llvm/lib/Target/AArch64/AArch64CallLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64CallLowering.cpp @@ -152,13 +152,13 @@ bool AArch64CallLowering::lowerReturn(MachineIRBuilder &MIRBuilder, return true; } -bool AArch64CallLowering::lowerFormalArguments( - MachineIRBuilder &MIRBuilder, const Function::ArgumentListType &Args, - ArrayRef VRegs) const { +bool AArch64CallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder, + const Function &F, + ArrayRef 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 Seqs; diff --git a/llvm/lib/Target/AArch64/AArch64CallLowering.h b/llvm/lib/Target/AArch64/AArch64CallLowering.h index 05b415f..452551d 100644 --- a/llvm/lib/Target/AArch64/AArch64CallLowering.h +++ b/llvm/lib/Target/AArch64/AArch64CallLowering.h @@ -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 VRegs) const override; bool lowerCall(MachineIRBuilder &MIRBuilder, const MachineOperand &Callee, diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp index 693c18c..ef18844 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp @@ -34,9 +34,9 @@ bool AMDGPUCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder, return true; } -bool AMDGPUCallLowering::lowerFormalArguments( - MachineIRBuilder &MIRBuilder, const Function::ArgumentListType &Args, - ArrayRef VRegs) const { +bool AMDGPUCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder, + const Function &F, + ArrayRef VRegs) const { // TODO: Implement once there are generic loads/stores. return true; } diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h index 60b801f..9ae87c9 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h @@ -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 VRegs) const override; + bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, + ArrayRef VRegs) const override; }; } // End of namespace llvm; #endif -- 2.7.4