Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick "[M68k] Fix ODR violation in GISel code (#72797)" #159

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion llvm/lib/Target/M68k/GISel/M68kCallLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@

using namespace llvm;

namespace {

struct M68kFormalArgHandler : public M68kIncomingValueHandler {
M68kFormalArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)
: M68kIncomingValueHandler(MIRBuilder, MRI) {}
};

struct CallReturnHandler : public M68kIncomingValueHandler {
CallReturnHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
MachineInstrBuilder &MIB)
: M68kIncomingValueHandler(MIRBuilder, MRI), MIB(MIB) {}

private:
void assignValueToReg(Register ValVReg, Register PhysReg,
const CCValAssign &VA) override;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be CCValAssign VA for LLVM 17. This causes the build failure in rust-lang/rust#119159.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh.
Fixed in #160.


MachineInstrBuilder &MIB;
};

} // end anonymous namespace

M68kCallLowering::M68kCallLowering(const M68kTargetLowering &TLI)
: CallLowering(&TLI) {}

Expand Down Expand Up @@ -118,7 +139,7 @@ bool M68kCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
CCAssignFn *AssignFn =
TLI.getCCAssignFn(F.getCallingConv(), false, F.isVarArg());
IncomingValueAssigner ArgAssigner(AssignFn);
FormalArgHandler ArgHandler(MIRBuilder, MRI);
M68kFormalArgHandler ArgHandler(MIRBuilder, MRI);
return determineAndHandleAssignments(ArgHandler, ArgAssigner, SplitArgs,
MIRBuilder, F.getCallingConv(),
F.isVarArg());
Expand Down
17 changes: 0 additions & 17 deletions llvm/lib/Target/M68k/GISel/M68kCallLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,6 @@ struct M68kIncomingValueHandler : public CallLowering::IncomingValueHandler {
MachinePointerInfo &MPO,
ISD::ArgFlagsTy Flags) override;
};

struct FormalArgHandler : public M68kIncomingValueHandler {
FormalArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)
: M68kIncomingValueHandler(MIRBuilder, MRI) {}
};

struct CallReturnHandler : public M68kIncomingValueHandler {
CallReturnHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
MachineInstrBuilder &MIB)
: M68kIncomingValueHandler(MIRBuilder, MRI), MIB(MIB) {}

private:
void assignValueToReg(Register ValVReg, Register PhysReg,
CCValAssign VA) override;

MachineInstrBuilder &MIB;
};
} // end namespace llvm

#endif // LLVM_LIB_TARGET_M68K_GLSEL_M68KCALLLOWERING_H