Skip to content

Commit

Permalink
[GISel][CallLowering] Make isIncomingArgumentHandler a pure virtual m…
Browse files Browse the repository at this point in the history
…ethod

The default implementation of isIncomingArgumentHandler could lead
to generating incorrect code.
Make it a pure virtual method, so that targets know they have to
override it to produce correct code.

NFC

Differential Revision: https://reviews.llvm.org/D69187

llvm-svn: 375277
  • Loading branch information
qcolombet committed Oct 18, 2019
1 parent cf25242 commit 9f9151d
Showing 5 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ class CallLowering {

/// Returns true if the handler is dealing with incoming arguments,
/// i.e. those that move values from some physical location to vregs.
virtual bool isIncomingArgumentHandler() const { return false; }
virtual bool isIncomingArgumentHandler() const = 0;

/// Materialize a VReg containing the address of the specified
/// stack-based object. This is either based on a FrameIndex or
2 changes: 2 additions & 0 deletions llvm/lib/Target/AArch64/AArch64CallLowering.cpp
Original file line number Diff line number Diff line change
@@ -136,6 +136,8 @@ struct OutgoingArgHandler : public CallLowering::ValueHandler {
AssignFnVarArg(AssignFnVarArg), IsTailCall(IsTailCall), FPDiff(FPDiff),
StackSize(0) {}

bool isIncomingArgumentHandler() const override { return false; }

Register getStackAddress(uint64_t Size, int64_t Offset,
MachinePointerInfo &MPO) override {
MachineFunction &MF = MIRBuilder.getMF();
2 changes: 2 additions & 0 deletions llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ struct OutgoingValueHandler : public CallLowering::ValueHandler {

MachineInstrBuilder MIB;

bool isIncomingArgumentHandler() const override { return false; }

Register getStackAddress(uint64_t Size, int64_t Offset,
MachinePointerInfo &MPO) override {
llvm_unreachable("not implemented");
2 changes: 2 additions & 0 deletions llvm/lib/Target/ARM/ARMCallLowering.cpp
Original file line number Diff line number Diff line change
@@ -90,6 +90,8 @@ struct OutgoingValueHandler : public CallLowering::ValueHandler {
MachineInstrBuilder &MIB, CCAssignFn *AssignFn)
: ValueHandler(MIRBuilder, MRI, AssignFn), MIB(MIB) {}

bool isIncomingArgumentHandler() const override { return false; }

Register getStackAddress(uint64_t Size, int64_t Offset,
MachinePointerInfo &MPO) override {
assert((Size == 1 || Size == 2 || Size == 4 || Size == 8) &&
2 changes: 2 additions & 0 deletions llvm/lib/Target/X86/X86CallLowering.cpp
Original file line number Diff line number Diff line change
@@ -102,6 +102,8 @@ struct OutgoingValueHandler : public CallLowering::ValueHandler {
DL(MIRBuilder.getMF().getDataLayout()),
STI(MIRBuilder.getMF().getSubtarget<X86Subtarget>()) {}

bool isIncomingArgumentHandler() const override { return false; }

Register getStackAddress(uint64_t Size, int64_t Offset,
MachinePointerInfo &MPO) override {
LLT p0 = LLT::pointer(0, DL.getPointerSizeInBits(0));

0 comments on commit 9f9151d

Please sign in to comment.