42#define DEBUG_TYPE "ppc-ctrloops-verify"
65 char PPCCTRLoopsVerify::ID = 0;
69 "PowerPC CTR Loops Verify",
false,
false)
75 return new PPCCTRLoopsVerify();
81 if (MO.isDef() && (MO.getReg() == PPC::CTR || MO.getReg() == PPC::CTR8))
83 }
else if (MO.isRegMask()) {
84 if (MO.clobbersPhysReg(PPC::CTR) || MO.clobbersPhysReg(PPC::CTR8))
112 unsigned Opc =
I->getOpcode();
113 if (
Opc == PPC::MTCTRloop ||
Opc == PPC::MTCTR8loop) {
120 <<
") instruction " << *
I
121 <<
" clobbers CTR, invalidating "
123 << BI->getParent()->getFullName() <<
") instruction "
132 if (!CheckPreds && Preds.
empty())
140 << BI->getParent()->getFullName() <<
") instruction "
154 }
while (!Preds.
empty());
160 MDT = &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
165 if (!MDT->isReachableFromEntry(&
MBB))
169 MIIE =
MBB.
end(); MII != MIIE; ++MII) {
170 unsigned Opc = MII->getOpcode();
171 if (
Opc == PPC::BDNZ8 ||
Opc == PPC::BDNZ ||
172 Opc == PPC::BDZ8 ||
Opc == PPC::BDZ)
static bool verifyCTRBranch(MachineBasicBlock *MBB, MachineBasicBlock::iterator I)
ppc ctr loops PowerPC CTR Loops Verify
static bool clobbersCTR(const MachineInstr &MI)
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
FunctionPass class - This class is used to implement most global optimizations.
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
LLVM_ABI iterator getLastNonDebugInstr(bool SkipPseudoOp=true)
Returns an iterator to the last non-debug instruction in the basic block, or end().
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
LLVM_ABI std::string getFullName() const
Return a formatted string to identify this block and its parent function.
iterator_range< pred_iterator > predecessors()
Analysis pass which computes a MachineDominatorTree.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
void initializePPCCTRLoopsVerifyPass(PassRegistry &)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FunctionPass * createPPCCTRLoopsVerify()
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.