llvm.org GIT mirror llvm / aa9f0a5
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 Owen Anderson 10 years ago
2 changed file(s) with 35 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2727
2828 using namespace llvm;
2929
30 static cl::opt
31 OldT2IfCvt("old-thumb2-ifcvt", cl::Hidden,
32 cl::desc("Use old-style Thumb2 if-conversion heuristics"),
33 cl::init(false));
34
3035 Thumb2InstrInfo::Thumb2InstrInfo(const ARMSubtarget &STI)
3136 : ARMBaseInstrInfo(STI), RI(*this, STI) {
3237 }
3540 // FIXME
3641 return 0;
3742 }
43
44 bool Thumb2InstrInfo::isProfitableToIfCvt(MachineBasicBlock &MBB,
45 unsigned NumInstrs,
46 float Prediction) const {
47 if (!OldT2IfCvt)
48 return ARMBaseInstrInfo::isProfitableToIfCvt(MBB, NumInstrs, Prediction);
49 return NumInstrs && NumInstrs <= 3;
50 }
51
52 bool Thumb2InstrInfo::
53 isProfitableToIfCvt(MachineBasicBlock &TMBB, unsigned NumT,
54 MachineBasicBlock &FMBB, unsigned NumF,
55 float Prediction) const {
56 if (!OldT2IfCvt)
57 return ARMBaseInstrInfo::isProfitableToIfCvt(TMBB, NumT,
58 FMBB, NumF, Prediction);
59
60 // FIXME: Catch optimization such as:
61 // r0 = movne
62 // r0 = moveq
63 return NumT && NumF &&
64 NumT <= 3 && NumF <= 3;
65 }
66
3867
3968 void
4069 Thumb2InstrInfo::ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail,
3636
3737 bool isLegalToSplitMBBAt(MachineBasicBlock &MBB,
3838 MachineBasicBlock::iterator MBBI) const;
39
40 bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumInstrs,
41 float Prediction) const;
42 bool isProfitableToIfCvt(MachineBasicBlock &TMBB, unsigned NumTInstrs,
43 MachineBasicBlock &FMBB, unsigned NumFInstrs,
44 float Prediction) const;
3945
4046 void copyPhysReg(MachineBasicBlock &MBB,
4147 MachineBasicBlock::iterator I, DebugLoc DL,