12#define DEBUG_TYPE "hexagon-loop-align"
23 cl::desc(
"Disable Hexagon loop alignment pass"));
27 cl::desc(
"Set hexagon hvx loop upper bound align limit"));
31 cl::desc(
"Set hexagon tiny-core loop upper bound align limit"));
35 cl::desc(
"Set hexagon loop upper bound align limit"));
39 cl::desc(
"Set hexagon loop lower bound align limit"));
44 cl::desc(
"Set hexagon loop align bundle limit"));
48 cl::desc(
"Set hexagon tiny-core loop align bundle limit"));
52 cl::desc(
"Set hexagon loop align edge theshold"));
85char HexagonLoopAlign::ID = 0;
101 if (
II->isBundle()) {
106 if (
II->isDebugInstr())
115 dbgs() <<
"Bundle Count : " << BndlCnt <<
"\n";
116 dbgs() <<
"Instruction Count : " << InstCnt <<
"\n";
119 unsigned LimitUB = 0;
136 BndlCnt <= LimitBndl;
146 if (!isSingleLoop(
MBB))
150 &getAnalysis<MachineBranchProbabilityInfoWrapperPass>().getMBPI();
152 &getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI();
159 dbgs() <<
"Loop Align Pass:\n";
164 if (shouldBalignLoop(
MBB, AboveThres)) {
193 if (HTM->
getOptLevel() < CodeGenOptLevel::Aggressive)
197 bool Changed =
false;
199 MBBi != MBBe; ++MBBi) {
201 Changed |= attemptToBalignSmallLoop(MF,
MBB);
209 "Hexagon LoopAlign pass",
false,
false)
static cl::opt< uint32_t > LoopEdgeThreshold("hexagon-loop-edge-threshold", cl::Hidden, cl::init(7500), cl::desc("Set hexagon loop align edge theshold"))
static cl::opt< uint32_t > LoopBndlAlignLimit("hexagon-loop-bundle-align-limit", cl::Hidden, cl::init(4), cl::desc("Set hexagon loop align bundle limit"))
static cl::opt< uint32_t > LoopAlignLimitUB("hexagon-loop-align-limit-ub", cl::Hidden, cl::init(8), cl::desc("Set hexagon loop upper bound align limit"))
static cl::opt< uint32_t > LoopAlignLimitLB("hexagon-loop-align-limit-lb", cl::Hidden, cl::init(4), cl::desc("Set hexagon loop lower bound align limit"))
static cl::opt< uint32_t > HVXLoopAlignLimitUB("hexagon-hvx-loop-align-limit-ub", cl::Hidden, cl::init(16), cl::desc("Set hexagon hvx loop upper bound align limit"))
static cl::opt< bool > DisableLoopAlign("disable-hexagon-loop-align", cl::Hidden, cl::desc("Disable Hexagon loop alignment pass"))
static cl::opt< uint32_t > TinyLoopAlignLimitUB("hexagon-tiny-loop-align-limit-ub", cl::Hidden, cl::init(16), cl::desc("Set hexagon tiny-core loop upper bound align limit"))
static cl::opt< uint32_t > TinyLoopBndlAlignLimit("hexagon-tiny-loop-bundle-align-limit", cl::Hidden, cl::init(8), cl::desc("Set hexagon tiny-core loop align bundle limit"))
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
FunctionPass class - This class is used to implement most global optimizations.
bool isHVXVec(const MachineInstr &MI) const
bool isEndLoopN(unsigned Opcode) const
const HexagonInstrInfo * getInstrInfo() const override
instr_iterator instr_begin()
unsigned succ_size() const
void setAlignment(Align A)
Set alignment of the basic block.
Instructions::iterator instr_iterator
instr_iterator instr_end()
bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
getblockFreq - Return block frequency.
BranchProbability getEdgeProbability(const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const
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...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createHexagonLoopAlign()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void initializeHexagonLoopAlignPass(PassRegistry &)
This struct is a compact representation of a valid (non-zero power of two) alignment.