mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
Revert rG57ee0435bd47f23f3939f402914c231b4f65ca5e - [TII] Use optional destination and source pair as a return value; NFC
This is breaking MSVC builds: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/20375
This commit is contained in:
parent
d2f1ea941b
commit
0c43a5aeb1
@ -64,11 +64,6 @@ template <class T> class SmallVectorImpl;
|
|||||||
|
|
||||||
using ParamLoadedValue = std::pair<MachineOperand, DIExpression*>;
|
using ParamLoadedValue = std::pair<MachineOperand, DIExpression*>;
|
||||||
|
|
||||||
struct DestSourcePair {
|
|
||||||
const MachineOperand &Destination;
|
|
||||||
const MachineOperand &Source;
|
|
||||||
};
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
/// TargetInstrInfo - Interface to description of machine instruction set
|
/// TargetInstrInfo - Interface to description of machine instruction set
|
||||||
@ -923,36 +918,41 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Target-dependent implementation for IsCopyInstr.
|
/// Target-dependent implemenation for IsCopyInstr.
|
||||||
/// If the specific machine instruction is a instruction that moves/copies
|
/// If the specific machine instruction is a instruction that moves/copies
|
||||||
/// value from one register to another register return destination and source
|
/// value from one register to another register return true along with
|
||||||
/// registers as machine operands.
|
/// @Source machine operand and @Destination machine operand.
|
||||||
virtual Optional<DestSourcePair>
|
virtual bool isCopyInstrImpl(const MachineInstr &MI,
|
||||||
isCopyInstrImpl(const MachineInstr &MI) const {
|
const MachineOperand *&Source,
|
||||||
return None;
|
const MachineOperand *&Destination) const {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// If the specific machine instruction is a instruction that moves/copies
|
/// If the specific machine instruction is a instruction that moves/copies
|
||||||
/// value from one register to another register return destination and source
|
/// value from one register to another register return true along with
|
||||||
/// registers as machine operands.
|
/// @Source machine operand and @Destination machine operand.
|
||||||
/// For COPY-instruction the method naturally returns destination and source
|
/// For COPY-instruction the method naturally returns true, for all other
|
||||||
/// registers as machine operands, for all other instructions the method calls
|
/// instructions the method calls target-dependent implementation.
|
||||||
/// target-dependent implementation.
|
bool isCopyInstr(const MachineInstr &MI, const MachineOperand *&Source,
|
||||||
Optional<DestSourcePair> isCopyInstr(const MachineInstr &MI) const {
|
const MachineOperand *&Destination) const {
|
||||||
if (MI.isCopy()) {
|
if (MI.isCopy()) {
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
|
Destination = &MI.getOperand(0);
|
||||||
|
Source = &MI.getOperand(1);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return isCopyInstrImpl(MI);
|
return isCopyInstrImpl(MI, Source, Destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the specific machine instruction is an instruction that adds an
|
/// If the specific machine instruction is an instruction that adds an
|
||||||
/// immediate value to its source operand and stores it in destination,
|
/// immediate value to its \c Source operand and stores it in \c Destination,
|
||||||
/// return destination and source registers as machine operands along with
|
/// return true along with \c Destination and \c Source machine operand to
|
||||||
/// \c Offset which has been added.
|
/// which \c Offset has been added.
|
||||||
virtual Optional<DestSourcePair> isAddImmediate(const MachineInstr &MI,
|
virtual bool isAddImmediate(const MachineInstr &MI,
|
||||||
int64_t &Offset) const {
|
const MachineOperand *&Destination,
|
||||||
return None;
|
const MachineOperand *&Source,
|
||||||
|
int64_t &Offset) const {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Store the specified register of the given register class to the specified
|
/// Store the specified register of the given register class to the specified
|
||||||
|
@ -997,14 +997,10 @@ void LiveDebugValues::transferRegisterCopy(MachineInstr &MI,
|
|||||||
OpenRangesSet &OpenRanges,
|
OpenRangesSet &OpenRanges,
|
||||||
VarLocMap &VarLocIDs,
|
VarLocMap &VarLocIDs,
|
||||||
TransferMap &Transfers) {
|
TransferMap &Transfers) {
|
||||||
|
const MachineOperand *SrcRegOp, *DestRegOp;
|
||||||
|
|
||||||
auto DestSrc = TII->isCopyInstr(MI);
|
if (!TII->isCopyInstr(MI, SrcRegOp, DestRegOp) || !SrcRegOp->isKill() ||
|
||||||
if (!DestSrc)
|
!DestRegOp->isDef())
|
||||||
return;
|
|
||||||
|
|
||||||
const MachineOperand &DestRegOp = DestSrc->Destination;
|
|
||||||
const MachineOperand &SrcRegOp = DestSrc->Source;
|
|
||||||
if (!SrcRegOp.isKill() || !DestRegOp.isDef())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto isCalleeSavedReg = [&](unsigned Reg) {
|
auto isCalleeSavedReg = [&](unsigned Reg) {
|
||||||
@ -1014,8 +1010,8 @@ void LiveDebugValues::transferRegisterCopy(MachineInstr &MI,
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
Register SrcReg = SrcRegOp.getReg();
|
Register SrcReg = SrcRegOp->getReg();
|
||||||
Register DestReg = DestRegOp.getReg();
|
Register DestReg = DestRegOp->getReg();
|
||||||
|
|
||||||
// We want to recognize instructions where destination register is callee
|
// We want to recognize instructions where destination register is callee
|
||||||
// saved register. If register that could be clobbered by the call is
|
// saved register. If register that could be clobbered by the call is
|
||||||
|
@ -1124,13 +1124,14 @@ Optional<ParamLoadedValue>
|
|||||||
TargetInstrInfo::describeLoadedValue(const MachineInstr &MI) const {
|
TargetInstrInfo::describeLoadedValue(const MachineInstr &MI) const {
|
||||||
const MachineFunction *MF = MI.getMF();
|
const MachineFunction *MF = MI.getMF();
|
||||||
DIExpression *Expr = DIExpression::get(MF->getFunction().getContext(), {});
|
DIExpression *Expr = DIExpression::get(MF->getFunction().getContext(), {});
|
||||||
|
const MachineOperand *SrcRegOp, *DestRegOp;
|
||||||
int64_t Offset;
|
int64_t Offset;
|
||||||
|
|
||||||
if (auto DestSrc = isCopyInstr(MI)) {
|
if (isCopyInstr(MI, SrcRegOp, DestRegOp)) {
|
||||||
return ParamLoadedValue(DestSrc->Source, Expr);
|
return ParamLoadedValue(*SrcRegOp, Expr);
|
||||||
} else if (auto DestSrc = isAddImmediate(MI, Offset)) {
|
} else if (isAddImmediate(MI, DestRegOp, SrcRegOp, Offset)) {
|
||||||
Expr = DIExpression::prepend(Expr, DIExpression::ApplyOffset, Offset);
|
Expr = DIExpression::prepend(Expr, DIExpression::ApplyOffset, Offset);
|
||||||
return ParamLoadedValue(DestSrc->Source, Expr);
|
return ParamLoadedValue(*SrcRegOp, Expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return None;
|
||||||
|
@ -5936,33 +5936,39 @@ bool AArch64InstrInfo::shouldOutlineFromFunctionByDefault(
|
|||||||
return MF.getFunction().hasMinSize();
|
return MF.getFunction().hasMinSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DestSourcePair>
|
bool AArch64InstrInfo::isCopyInstrImpl(
|
||||||
AArch64InstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
|
const MachineInstr &MI, const MachineOperand *&Source,
|
||||||
|
const MachineOperand *&Destination) const {
|
||||||
|
|
||||||
// AArch64::ORRWrs and AArch64::ORRXrs with WZR/XZR reg
|
// AArch64::ORRWrs and AArch64::ORRXrs with WZR/XZR reg
|
||||||
// and zero immediate operands used as an alias for mov instruction.
|
// and zero immediate operands used as an alias for mov instruction.
|
||||||
if (MI.getOpcode() == AArch64::ORRWrs &&
|
if (MI.getOpcode() == AArch64::ORRWrs &&
|
||||||
MI.getOperand(1).getReg() == AArch64::WZR &&
|
MI.getOperand(1).getReg() == AArch64::WZR &&
|
||||||
MI.getOperand(3).getImm() == 0x0) {
|
MI.getOperand(3).getImm() == 0x0) {
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(2)};
|
Destination = &MI.getOperand(0);
|
||||||
|
Source = &MI.getOperand(2);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MI.getOpcode() == AArch64::ORRXrs &&
|
if (MI.getOpcode() == AArch64::ORRXrs &&
|
||||||
MI.getOperand(1).getReg() == AArch64::XZR &&
|
MI.getOperand(1).getReg() == AArch64::XZR &&
|
||||||
MI.getOperand(3).getImm() == 0x0) {
|
MI.getOperand(3).getImm() == 0x0) {
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(2)};
|
Destination = &MI.getOperand(0);
|
||||||
|
Source = &MI.getOperand(2);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return None;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DestSourcePair>
|
bool AArch64InstrInfo::isAddImmediate(const MachineInstr &MI,
|
||||||
AArch64InstrInfo::isAddImmediate(const MachineInstr &MI,
|
const MachineOperand *&Destination,
|
||||||
int64_t &Offset) const {
|
const MachineOperand *&Source,
|
||||||
|
int64_t &Offset) const {
|
||||||
int Sign = 1;
|
int Sign = 1;
|
||||||
switch (MI.getOpcode()) {
|
switch (MI.getOpcode()) {
|
||||||
default:
|
default:
|
||||||
return None;
|
return false;
|
||||||
case AArch64::SUBWri:
|
case AArch64::SUBWri:
|
||||||
case AArch64::SUBXri:
|
case AArch64::SUBXri:
|
||||||
case AArch64::SUBSWri:
|
case AArch64::SUBSWri:
|
||||||
@ -5976,14 +5982,16 @@ AArch64InstrInfo::isAddImmediate(const MachineInstr &MI,
|
|||||||
// TODO: Third operand can be global address (usually some string).
|
// TODO: Third operand can be global address (usually some string).
|
||||||
if (!MI.getOperand(0).isReg() || !MI.getOperand(1).isReg() ||
|
if (!MI.getOperand(0).isReg() || !MI.getOperand(1).isReg() ||
|
||||||
!MI.getOperand(2).isImm())
|
!MI.getOperand(2).isImm())
|
||||||
return None;
|
return false;
|
||||||
|
Source = &MI.getOperand(1);
|
||||||
Offset = MI.getOperand(2).getImm() * Sign;
|
Offset = MI.getOperand(2).getImm() * Sign;
|
||||||
int Shift = MI.getOperand(3).getImm();
|
int Shift = MI.getOperand(3).getImm();
|
||||||
assert((Shift == 0 || Shift == 12) && "Shift can be either 0 or 12");
|
assert((Shift == 0 || Shift == 12) && "Shift can be either 0 or 12");
|
||||||
Offset = Offset << Shift;
|
Offset = Offset << Shift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
|
Destination = &MI.getOperand(0);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<ParamLoadedValue>
|
Optional<ParamLoadedValue>
|
||||||
|
@ -265,8 +265,10 @@ public:
|
|||||||
/// on Windows.
|
/// on Windows.
|
||||||
static bool isSEHInstruction(const MachineInstr &MI);
|
static bool isSEHInstruction(const MachineInstr &MI);
|
||||||
|
|
||||||
Optional<DestSourcePair> isAddImmediate(const MachineInstr &MI,
|
bool isAddImmediate(const MachineInstr &MI,
|
||||||
int64_t &Offset) const override;
|
const MachineOperand *&Destination,
|
||||||
|
const MachineOperand *&Source,
|
||||||
|
int64_t &Offset) const override;
|
||||||
|
|
||||||
Optional<ParamLoadedValue>
|
Optional<ParamLoadedValue>
|
||||||
describeLoadedValue(const MachineInstr &MI) const override;
|
describeLoadedValue(const MachineInstr &MI) const override;
|
||||||
@ -275,11 +277,11 @@ public:
|
|||||||
#include "AArch64GenInstrInfo.inc"
|
#include "AArch64GenInstrInfo.inc"
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// If the specific machine instruction is an instruction that moves/copies
|
/// If the specific machine instruction is a instruction that moves/copies
|
||||||
/// value from one register to another register return destination and source
|
/// value from one register to another register return true along with
|
||||||
/// registers as machine operands.
|
/// @Source machine operand and @Destination machine operand.
|
||||||
Optional<DestSourcePair>
|
bool isCopyInstrImpl(const MachineInstr &MI, const MachineOperand *&Source,
|
||||||
isCopyInstrImpl(const MachineInstr &MI) const override;
|
const MachineOperand *&Destination) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Sets the offsets on outlined instructions in \p MBB which use SP
|
/// Sets the offsets on outlined instructions in \p MBB which use SP
|
||||||
|
@ -993,8 +993,9 @@ void ARMBaseInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
|||||||
Mov->addRegisterKilled(SrcReg, TRI);
|
Mov->addRegisterKilled(SrcReg, TRI);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DestSourcePair>
|
bool ARMBaseInstrInfo::isCopyInstrImpl(const MachineInstr &MI,
|
||||||
ARMBaseInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
|
const MachineOperand *&Src,
|
||||||
|
const MachineOperand *&Dest) const {
|
||||||
// VMOVRRD is also a copy instruction but it requires
|
// VMOVRRD is also a copy instruction but it requires
|
||||||
// special way of handling. It is more complex copy version
|
// special way of handling. It is more complex copy version
|
||||||
// and since that we are not considering it. For recognition
|
// and since that we are not considering it. For recognition
|
||||||
@ -1005,8 +1006,10 @@ ARMBaseInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
|
|||||||
if (!MI.isMoveReg() ||
|
if (!MI.isMoveReg() ||
|
||||||
(MI.getOpcode() == ARM::VORRq &&
|
(MI.getOpcode() == ARM::VORRq &&
|
||||||
MI.getOperand(1).getReg() != MI.getOperand(2).getReg()))
|
MI.getOperand(1).getReg() != MI.getOperand(2).getReg()))
|
||||||
return None;
|
return false;
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
|
Dest = &MI.getOperand(0);
|
||||||
|
Src = &MI.getOperand(1);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MachineInstrBuilder &
|
const MachineInstrBuilder &
|
||||||
@ -5347,9 +5350,10 @@ ARMBaseInstrInfo::getSerializableBitmaskMachineOperandTargetFlags() const {
|
|||||||
return makeArrayRef(TargetFlags);
|
return makeArrayRef(TargetFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DestSourcePair>
|
bool ARMBaseInstrInfo::isAddImmediate(const MachineInstr &MI,
|
||||||
ARMBaseInstrInfo::isAddImmediate(const MachineInstr &MI,
|
const MachineOperand *&Destination,
|
||||||
int64_t &Offset) const {
|
const MachineOperand *&Source,
|
||||||
|
int64_t &Offset) const {
|
||||||
int Sign = 1;
|
int Sign = 1;
|
||||||
unsigned Opcode = MI.getOpcode();
|
unsigned Opcode = MI.getOpcode();
|
||||||
|
|
||||||
@ -5357,17 +5361,19 @@ ARMBaseInstrInfo::isAddImmediate(const MachineInstr &MI,
|
|||||||
if (Opcode == ARM::SUBri)
|
if (Opcode == ARM::SUBri)
|
||||||
Sign = -1;
|
Sign = -1;
|
||||||
else if (Opcode != ARM::ADDri)
|
else if (Opcode != ARM::ADDri)
|
||||||
return None;
|
return false;
|
||||||
|
|
||||||
// TODO: Third operand can be global address (usually some string). Since
|
// TODO: Third operand can be global address (usually some string). Since
|
||||||
// strings can be relocated we cannot calculate their offsets for
|
// strings can be relocated we cannot calculate their offsets for
|
||||||
// now.
|
// now.
|
||||||
if (!MI.getOperand(0).isReg() || !MI.getOperand(1).isReg() ||
|
if (!MI.getOperand(0).isReg() || !MI.getOperand(1).isReg() ||
|
||||||
!MI.getOperand(2).isImm())
|
!MI.getOperand(2).isImm())
|
||||||
return None;
|
return false;
|
||||||
|
|
||||||
|
Destination = &MI.getOperand(0);
|
||||||
|
Source = &MI.getOperand(1);
|
||||||
Offset = MI.getOperand(2).getImm() * Sign;
|
Offset = MI.getOperand(2).getImm() * Sign;
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool llvm::registerDefinedBetween(unsigned Reg,
|
bool llvm::registerDefinedBetween(unsigned Reg,
|
||||||
|
@ -99,11 +99,12 @@ protected:
|
|||||||
MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI,
|
MachineInstr *commuteInstructionImpl(MachineInstr &MI, bool NewMI,
|
||||||
unsigned OpIdx1,
|
unsigned OpIdx1,
|
||||||
unsigned OpIdx2) const override;
|
unsigned OpIdx2) const override;
|
||||||
/// If the specific machine instruction is an instruction that moves/copies
|
|
||||||
/// value from one register to another register return destination and source
|
/// If the specific machine instruction is a instruction that moves/copies
|
||||||
/// registers as machine operands.
|
/// value from one register to another register return true along with
|
||||||
Optional<DestSourcePair>
|
/// @Source machine operand and @Destination machine operand.
|
||||||
isCopyInstrImpl(const MachineInstr &MI) const override;
|
bool isCopyInstrImpl(const MachineInstr &MI, const MachineOperand *&Source,
|
||||||
|
const MachineOperand *&Destination) const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Return whether the target has an explicit NOP encoding.
|
// Return whether the target has an explicit NOP encoding.
|
||||||
@ -455,8 +456,10 @@ public:
|
|||||||
return MI.getOperand(3).getReg();
|
return MI.getOperand(3).getReg();
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DestSourcePair> isAddImmediate(const MachineInstr &MI,
|
bool isAddImmediate(const MachineInstr &MI,
|
||||||
int64_t &Offset) const override;
|
const MachineOperand *&Destination,
|
||||||
|
const MachineOperand *&Source,
|
||||||
|
int64_t &Offset) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Get the operands corresponding to the given \p Pred value. By default, the
|
/// Get the operands corresponding to the given \p Pred value. By default, the
|
||||||
|
@ -96,11 +96,15 @@ void Mips16InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
|||||||
MIB.addReg(SrcReg, getKillRegState(KillSrc));
|
MIB.addReg(SrcReg, getKillRegState(KillSrc));
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DestSourcePair>
|
bool Mips16InstrInfo::isCopyInstrImpl(const MachineInstr &MI,
|
||||||
Mips16InstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
|
const MachineOperand *&Src,
|
||||||
if (MI.isMoveReg())
|
const MachineOperand *&Dest) const {
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
|
if (MI.isMoveReg()) {
|
||||||
return None;
|
Dest = &MI.getOperand(0);
|
||||||
|
Src = &MI.getOperand(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mips16InstrInfo::storeRegToStack(MachineBasicBlock &MBB,
|
void Mips16InstrInfo::storeRegToStack(MachineBasicBlock &MBB,
|
||||||
|
@ -104,9 +104,10 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// If the specific machine instruction is a instruction that moves/copies
|
/// If the specific machine instruction is a instruction that moves/copies
|
||||||
/// value from one register to another register return destination and source
|
/// value from one register to another register return true along with
|
||||||
/// registers as machine operands.
|
/// @Source machine operand and @Destination machine operand.
|
||||||
Optional<DestSourcePair> isCopyInstrImpl(const MachineInstr &MI) const override;
|
bool isCopyInstrImpl(const MachineInstr &MI, const MachineOperand *&Source,
|
||||||
|
const MachineOperand *&Destination) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned getAnalyzableBrOpc(unsigned Opc) const override;
|
unsigned getAnalyzableBrOpc(unsigned Opc) const override;
|
||||||
|
@ -221,24 +221,29 @@ static bool isReadOrWriteToDSPReg(const MachineInstr &MI, bool &isWrite) {
|
|||||||
/// We check for the common case of 'or', as it's MIPS' preferred instruction
|
/// We check for the common case of 'or', as it's MIPS' preferred instruction
|
||||||
/// for GPRs but we have to check the operands to ensure that is the case.
|
/// for GPRs but we have to check the operands to ensure that is the case.
|
||||||
/// Other move instructions for MIPS are directly identifiable.
|
/// Other move instructions for MIPS are directly identifiable.
|
||||||
Optional<DestSourcePair>
|
bool MipsSEInstrInfo::isCopyInstrImpl(const MachineInstr &MI,
|
||||||
MipsSEInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
|
const MachineOperand *&Src,
|
||||||
|
const MachineOperand *&Dest) const {
|
||||||
bool isDSPControlWrite = false;
|
bool isDSPControlWrite = false;
|
||||||
// Condition is made to match the creation of WRDSP/RDDSP copy instruction
|
// Condition is made to match the creation of WRDSP/RDDSP copy instruction
|
||||||
// from copyPhysReg function.
|
// from copyPhysReg function.
|
||||||
if (isReadOrWriteToDSPReg(MI, isDSPControlWrite)) {
|
if (isReadOrWriteToDSPReg(MI, isDSPControlWrite)) {
|
||||||
if (!MI.getOperand(1).isImm() || MI.getOperand(1).getImm() != (1 << 4))
|
if (!MI.getOperand(1).isImm() || MI.getOperand(1).getImm() != (1<<4))
|
||||||
return None;
|
return false;
|
||||||
else if (isDSPControlWrite) {
|
else if (isDSPControlWrite) {
|
||||||
return DestSourcePair{MI.getOperand(2), MI.getOperand(0)};
|
Src = &MI.getOperand(0);
|
||||||
|
Dest = &MI.getOperand(2);
|
||||||
} else {
|
} else {
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(2)};
|
Dest = &MI.getOperand(0);
|
||||||
|
Src = &MI.getOperand(2);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} else if (MI.isMoveReg() || isORCopyInst(MI)) {
|
} else if (MI.isMoveReg() || isORCopyInst(MI)) {
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
|
Dest = &MI.getOperand(0);
|
||||||
|
Src = &MI.getOperand(1);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return None;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipsSEInstrInfo::
|
void MipsSEInstrInfo::
|
||||||
|
@ -77,10 +77,10 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// If the specific machine instruction is a instruction that moves/copies
|
/// If the specific machine instruction is a instruction that moves/copies
|
||||||
/// value from one register to another register return destination and source
|
/// value from one register to another register return true along with
|
||||||
/// registers as machine operands.
|
/// @Source machine operand and @Destination machine operand.
|
||||||
Optional<DestSourcePair>
|
bool isCopyInstrImpl(const MachineInstr &MI, const MachineOperand *&Source,
|
||||||
isCopyInstrImpl(const MachineInstr &MI) const override;
|
const MachineOperand *&Destination) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned getAnalyzableBrOpc(unsigned Opc) const override;
|
unsigned getAnalyzableBrOpc(unsigned Opc) const override;
|
||||||
|
@ -3046,11 +3046,15 @@ void X86InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
|||||||
report_fatal_error("Cannot emit physreg copy instruction");
|
report_fatal_error("Cannot emit physreg copy instruction");
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DestSourcePair>
|
bool X86InstrInfo::isCopyInstrImpl(const MachineInstr &MI,
|
||||||
X86InstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
|
const MachineOperand *&Src,
|
||||||
if (MI.isMoveReg())
|
const MachineOperand *&Dest) const {
|
||||||
return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
|
if (MI.isMoveReg()) {
|
||||||
return None;
|
Dest = &MI.getOperand(0);
|
||||||
|
Src = &MI.getOperand(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned getLoadStoreRegOpcode(unsigned Reg,
|
static unsigned getLoadStoreRegOpcode(unsigned Reg,
|
||||||
|
@ -542,10 +542,10 @@ protected:
|
|||||||
unsigned CommuteOpIdx2) const override;
|
unsigned CommuteOpIdx2) const override;
|
||||||
|
|
||||||
/// If the specific machine instruction is a instruction that moves/copies
|
/// If the specific machine instruction is a instruction that moves/copies
|
||||||
/// value from one register to another register return destination and source
|
/// value from one register to another register return true along with
|
||||||
/// registers as machine operands.
|
/// @Source machine operand and @Destination machine operand.
|
||||||
Optional<DestSourcePair>
|
bool isCopyInstrImpl(const MachineInstr &MI, const MachineOperand *&Source,
|
||||||
isCopyInstrImpl(const MachineInstr &MI) const override;
|
const MachineOperand *&Destination) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// This is a helper for convertToThreeAddress for 8 and 16-bit instructions.
|
/// This is a helper for convertToThreeAddress for 8 and 16-bit instructions.
|
||||||
|
Loading…
Reference in New Issue
Block a user