12#define DEBUG_TYPE "hexagon-loop-align"
24 cl::desc(
"Disable Hexagon loop alignment pass"));
28 cl::desc(
"Set hexagon hvx loop upper bound align limit"));
32 cl::desc(
"Set hexagon tiny-core loop upper bound align limit"));
36 cl::desc(
"Set hexagon loop upper bound align limit"));
40 cl::desc(
"Set hexagon loop lower bound align limit"));
45 cl::desc(
"Set hexagon loop align bundle limit"));
49 cl::desc(
"Set hexagon tiny-core loop align bundle limit"));
53 cl::desc(
"Set hexagon loop align edge theshold"));
86char HexagonLoopAlign::ID = 0;
102 if (
II->isBundle()) {
107 if (
II->isDebugInstr())
116 dbgs() <<
"Bundle Count : " << BndlCnt <<
"\n";
117 dbgs() <<
"Instruction Count : " << InstCnt <<
"\n";
120 unsigned LimitUB = 0;
137 BndlCnt <= LimitBndl;
147 if (!isSingleLoop(
MBB))
151 &getAnalysis<MachineBranchProbabilityInfoWrapperPass>().getMBPI();
153 &getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI();
160 dbgs() <<
"Loop Align Pass:\n";
165 if (shouldBalignLoop(
MBB, AboveThres)) {
194 if (HTM->
getOptLevel() < CodeGenOptLevel::Aggressive)
198 bool Changed =
false;
200 MBBi != MBBe; ++MBBi) {
202 Changed |= attemptToBalignSmallLoop(MF,
MBB);
210 "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 LLVMTargetMachine & 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.