GlobalISel: Add observer argument to legalizeIntrinsic

This is passed to legalizeCustom, but not intrinsic. Also remove the
MRI argument, since you can get that from the MachineIRBuilder.

I'm not sure why MachineIRBuilder has a private observer member, and
this is passed separately.
This commit is contained in:
Matt Arsenault 2020-01-27 15:50:55 -05:00 committed by Matt Arsenault
parent 29181e5426
commit c5fffa4da3
11 changed files with 27 additions and 27 deletions

View File

@ -1155,8 +1155,8 @@ public:
/// Return true if MI is either legal or has been legalized and false
/// if not legal.
virtual bool legalizeIntrinsic(MachineInstr &MI, MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const;
virtual bool legalizeIntrinsic(MachineInstr &MI, MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const;
/// Return the opcode (SEXT/ZEXT/ANYEXT) that should be performed while
/// widening a constant of type SmallTy which targets can override.

View File

@ -114,8 +114,8 @@ LegalizerHelper::legalizeInstrStep(MachineInstr &MI) {
if (MI.getOpcode() == TargetOpcode::G_INTRINSIC ||
MI.getOpcode() == TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS)
return LI.legalizeIntrinsic(MI, MRI, MIRBuilder) ? Legalized
: UnableToLegalize;
return LI.legalizeIntrinsic(MI, MIRBuilder, Observer) ? Legalized
: UnableToLegalize;
auto Step = LI.getAction(MI, MRI);
switch (Step.Action) {
case Legal:

View File

@ -682,8 +682,8 @@ LegalizerInfo::findVectorLegalAction(const InstrAspect &Aspect) const {
}
bool LegalizerInfo::legalizeIntrinsic(MachineInstr &MI,
MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const {
MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const {
return true;
}

View File

@ -640,13 +640,13 @@ bool AArch64LegalizerInfo::legalizeCustom(MachineInstr &MI,
}
bool AArch64LegalizerInfo::legalizeIntrinsic(
MachineInstr &MI, MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const {
MachineInstr &MI, MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const {
switch (MI.getIntrinsicID()) {
case Intrinsic::memcpy:
case Intrinsic::memset:
case Intrinsic::memmove:
if (createMemLibcall(MIRBuilder, MRI, MI) ==
if (createMemLibcall(MIRBuilder, *MIRBuilder.getMRI(), MI) ==
LegalizerHelper::UnableToLegalize)
return false;
MI.eraseFromParent();

View File

@ -31,8 +31,8 @@ public:
MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const override;
bool legalizeIntrinsic(MachineInstr &MI, MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const override;
bool legalizeIntrinsic(MachineInstr &MI, MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const override;
private:
bool legalizeVaArg(MachineInstr &MI, MachineRegisterInfo &MRI,

View File

@ -2768,10 +2768,10 @@ bool AMDGPULegalizerInfo::legalizeBufferAtomic(MachineInstr &MI,
return true;
}
// FIMXE: Needs observer like custom
bool AMDGPULegalizerInfo::legalizeIntrinsic(MachineInstr &MI,
MachineRegisterInfo &MRI,
MachineIRBuilder &B) const {
bool AMDGPULegalizerInfo::legalizeIntrinsic(
MachineInstr &MI, MachineIRBuilder &B,
GISelChangeObserver &Observer) const {
MachineRegisterInfo &MRI = *B.getMRI();
// Replace the use G_BRCOND with the exec manipulate and branch pseudos.
auto IntrID = MI.getIntrinsicID();
switch (IntrID) {

View File

@ -129,9 +129,8 @@ public:
bool legalizeAtomicIncDec(MachineInstr &MI, MachineIRBuilder &B,
bool IsInc) const;
bool legalizeIntrinsic(MachineInstr &MI, MachineRegisterInfo &MRI,
MachineIRBuilder &B) const override;
bool legalizeIntrinsic(MachineInstr &MI, MachineIRBuilder &B,
GISelChangeObserver &Observer) const override;
};
} // End llvm namespace.
#endif

View File

@ -369,8 +369,9 @@ static bool MSA2OpIntrinsicToGeneric(MachineInstr &MI, unsigned Opcode,
}
bool MipsLegalizerInfo::legalizeIntrinsic(MachineInstr &MI,
MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const {
MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const {
MachineRegisterInfo &MRI = *MIRBuilder.getMRI();
const MipsSubtarget &ST =
static_cast<const MipsSubtarget &>(MI.getMF()->getSubtarget());
const MipsInstrInfo &TII = *ST.getInstrInfo();

View File

@ -29,8 +29,8 @@ public:
MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const override;
bool legalizeIntrinsic(MachineInstr &MI, MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const override;
bool legalizeIntrinsic(MachineInstr &MI, MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const override;
};
} // end namespace llvm
#endif

View File

@ -86,13 +86,13 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
}
bool X86LegalizerInfo::legalizeIntrinsic(MachineInstr &MI,
MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const {
MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const {
switch (MI.getIntrinsicID()) {
case Intrinsic::memcpy:
case Intrinsic::memset:
case Intrinsic::memmove:
if (createMemLibcall(MIRBuilder, MRI, MI) ==
if (createMemLibcall(MIRBuilder, *MIRBuilder.getMRI(), MI) ==
LegalizerHelper::UnableToLegalize)
return false;
MI.eraseFromParent();

View File

@ -32,8 +32,8 @@ private:
public:
X86LegalizerInfo(const X86Subtarget &STI, const X86TargetMachine &TM);
bool legalizeIntrinsic(MachineInstr &MI, MachineRegisterInfo &MRI,
MachineIRBuilder &MIRBuilder) const override;
bool legalizeIntrinsic(MachineInstr &MI, MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const override;
private:
void setLegalizerInfo32bit();