mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Provide an option to restore old-style if-conversion heuristics for Thumb2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115339 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -28,6 +28,11 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
static cl::opt<bool>
|
||||||
|
OldT2IfCvt("old-thumb2-ifcvt", cl::Hidden,
|
||||||
|
cl::desc("Use old-style Thumb2 if-conversion heuristics"),
|
||||||
|
cl::init(false));
|
||||||
|
|
||||||
Thumb2InstrInfo::Thumb2InstrInfo(const ARMSubtarget &STI)
|
Thumb2InstrInfo::Thumb2InstrInfo(const ARMSubtarget &STI)
|
||||||
: ARMBaseInstrInfo(STI), RI(*this, STI) {
|
: ARMBaseInstrInfo(STI), RI(*this, STI) {
|
||||||
}
|
}
|
||||||
@@ -37,6 +42,30 @@ unsigned Thumb2InstrInfo::getUnindexedOpcode(unsigned Opc) const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Thumb2InstrInfo::isProfitableToIfCvt(MachineBasicBlock &MBB,
|
||||||
|
unsigned NumInstrs,
|
||||||
|
float Prediction) const {
|
||||||
|
if (!OldT2IfCvt)
|
||||||
|
return ARMBaseInstrInfo::isProfitableToIfCvt(MBB, NumInstrs, Prediction);
|
||||||
|
return NumInstrs && NumInstrs <= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Thumb2InstrInfo::
|
||||||
|
isProfitableToIfCvt(MachineBasicBlock &TMBB, unsigned NumT,
|
||||||
|
MachineBasicBlock &FMBB, unsigned NumF,
|
||||||
|
float Prediction) const {
|
||||||
|
if (!OldT2IfCvt)
|
||||||
|
return ARMBaseInstrInfo::isProfitableToIfCvt(TMBB, NumT,
|
||||||
|
FMBB, NumF, Prediction);
|
||||||
|
|
||||||
|
// FIXME: Catch optimization such as:
|
||||||
|
// r0 = movne
|
||||||
|
// r0 = moveq
|
||||||
|
return NumT && NumF &&
|
||||||
|
NumT <= 3 && NumF <= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Thumb2InstrInfo::ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail,
|
Thumb2InstrInfo::ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail,
|
||||||
MachineBasicBlock *NewDest) const {
|
MachineBasicBlock *NewDest) const {
|
||||||
|
@@ -38,6 +38,12 @@ public:
|
|||||||
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB,
|
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator MBBI) const;
|
MachineBasicBlock::iterator MBBI) const;
|
||||||
|
|
||||||
|
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumInstrs,
|
||||||
|
float Prediction) const;
|
||||||
|
bool isProfitableToIfCvt(MachineBasicBlock &TMBB, unsigned NumTInstrs,
|
||||||
|
MachineBasicBlock &FMBB, unsigned NumFInstrs,
|
||||||
|
float Prediction) const;
|
||||||
|
|
||||||
void copyPhysReg(MachineBasicBlock &MBB,
|
void copyPhysReg(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator I, DebugLoc DL,
|
MachineBasicBlock::iterator I, DebugLoc DL,
|
||||||
unsigned DestReg, unsigned SrcReg,
|
unsigned DestReg, unsigned SrcReg,
|
||||||
|
Reference in New Issue
Block a user