diff options
author | Owen Anderson <resistor@mac.com> | 2010-10-01 20:28:06 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-10-01 20:28:06 +0000 |
commit | 671d57865eefb1dfd603188d3ad86665b89cc7b1 (patch) | |
tree | 85b8717616a632086b2e28cdcb158a095c228372 /llvm/lib/Target/ARM | |
parent | 99a26afd4968d5221fba932258629489d88b681c (diff) | |
download | bcm5719-llvm-671d57865eefb1dfd603188d3ad86665b89cc7b1.tar.gz bcm5719-llvm-671d57865eefb1dfd603188d3ad86665b89cc7b1.zip |
Provide an option to restore old-style if-conversion heuristics for Thumb2.
llvm-svn: 115339
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r-- | llvm/lib/Target/ARM/Thumb2InstrInfo.cpp | 29 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/Thumb2InstrInfo.h | 6 |
2 files changed, 35 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp index 49f5e4a9509..a79b4ae4b31 100644 --- a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp +++ b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp @@ -28,6 +28,11 @@ 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) : ARMBaseInstrInfo(STI), RI(*this, STI) { } @@ -37,6 +42,30 @@ unsigned Thumb2InstrInfo::getUnindexedOpcode(unsigned Opc) const { 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 Thumb2InstrInfo::ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail, MachineBasicBlock *NewDest) const { diff --git a/llvm/lib/Target/ARM/Thumb2InstrInfo.h b/llvm/lib/Target/ARM/Thumb2InstrInfo.h index 9ed7eea7e2d..f9b1f32e627 100644 --- a/llvm/lib/Target/ARM/Thumb2InstrInfo.h +++ b/llvm/lib/Target/ARM/Thumb2InstrInfo.h @@ -38,6 +38,12 @@ public: bool isLegalToSplitMBBAt(MachineBasicBlock &MBB, 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, MachineBasicBlock::iterator I, DebugLoc DL, unsigned DestReg, unsigned SrcReg, |