10 #define DEBUG_TYPE "thumb2-it"
22 STATISTIC(NumITs,
"Number of IT blocks inserted");
23 STATISTIC(NumMovedInsts,
"Number of predicated instructions moved");
38 virtual const char *getPassName()
const {
39 return "Thumb IT blocks insertion pass";
67 if (!Reg || Reg == ARM::ITSTATE || Reg == ARM::SP)
75 for (
unsigned i = 0, e = LocalUses.
size(); i != e; ++i) {
76 unsigned Reg = LocalUses[i];
82 for (
unsigned i = 0, e = LocalDefs.
size(); i != e; ++i) {
83 unsigned Reg = LocalDefs[i];
116 "Sub-register indices still around?");
150 while (I != E && I->isDebugValue())
153 unsigned NPredReg = 0;
155 if (NCC == CC || NCC == OCC)
162 bool Modified =
false;
170 unsigned PredReg = 0;
195 unsigned Mask = 0, Pos = 3;
202 for (; MBBI != E && Pos &&
204 if (MBBI->isDebugValue())
210 unsigned NPredReg = 0;
212 if (NCC == CC || NCC == OCC) {
213 Mask |= (NCC & 1) << Pos;
220 MoveCopyOutOfITBlock(NMI, CC, OCC, Defs, Uses)) {
223 MBB.
insert(InsertPos, NMI);
237 Mask |= (CC & 1) << 4;
261 if (!AFI->isThumbFunction())
264 bool Modified =
false;
268 Modified |= InsertITInstructions(MBB);
272 AFI->setHasITBlocks(
true);
280 return new Thumb2ITBlockPass();
void push_back(const T &Elt)
static bool isCopy(MachineInstr *MI)
bool isBranch(QueryType Type=AnyInBundle) const
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
const MCInstrDesc & getDesc() const
Instructions::iterator instr_iterator
ARMCC::CondCodes getITInstrPredicate(const MachineInstr *MI, unsigned &PredReg)
LoopInfoBase< BlockT, LoopT > * LI
const HexagonInstrInfo * TII
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
ID
LLVM Calling Convention Representation.
const MachineInstrBuilder & addImm(int64_t Val) const
unsigned getNumOperands() const
const MachineBasicBlock * getParent() const
bundle_iterator< MachineInstr, instr_iterator > iterator
bool isReturn(QueryType Type=AnyInBundle) const
STATISTIC(NumITs,"Number of IT blocks inserted")
const MachineOperand & getOperand(unsigned i) const
ItTy next(ItTy it, Dist n)
static void TrackDefUses(MachineInstr *MI, SmallSet< unsigned, 4 > &Defs, SmallSet< unsigned, 4 > &Uses, const TargetRegisterInfo *TRI)
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
unsigned getSubReg() const
void setIsKill(bool Val=true)
virtual const TargetInstrInfo * getInstrInfo() const
MachineOperand * findRegisterUseOperand(unsigned Reg, bool isKill=false, const TargetRegisterInfo *TRI=NULL)
const STC & getSubtarget() const
void addOperand(MachineFunction &MF, const MachineOperand &Op)
MachineInstr * remove(MachineInstr *I)
bool count(const T &V) const
count - Return true if the element is in the set.
static CondCodes getOppositeCondition(CondCodes CC)
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
const TargetMachine & getTarget() const
instr_iterator insert(instr_iterator I, MachineInstr *M)
virtual const TargetRegisterInfo * getRegisterInfo() const
unsigned getReg() const
getReg - Returns the register number.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction. Note that variadic (isVari...
BasicBlockListType::iterator iterator
FunctionPass * createThumb2ITBlockPass()
bool hasOptionalDef(QueryType Type=IgnoreBundle) const
void finalizeBundle(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
DebugLoc getDebugLoc() const