10 #ifndef LLVM_LIB_CODEGEN_BRANCHFOLDING_H
11 #define LLVM_LIB_CODEGEN_BRANCHFOLDING_H
20 class MachineBlockFrequencyInfo;
21 class MachineBranchProbabilityInfo;
22 class MachineFunction;
23 class MachineModuleInfo;
24 class MachineLoopInfo;
25 class TargetInstrInfo;
26 class TargetRegisterInfo;
38 unsigned MinCommonTailLength = 0);
46 bool AfterPlacement =
false);
49 class MergePotentialsElt {
54 :
Hash(h), Block(b) {}
56 unsigned getHash()
const {
return Hash; }
63 bool operator<(
const MergePotentialsElt &)
const;
65 typedef std::vector<MergePotentialsElt>::iterator MPIterator;
66 std::vector<MergePotentialsElt> MergePotentials;
75 : MPIter(mp), TailStartPos(tsp) {}
77 MPIterator getMPIter()
const {
80 MergePotentialsElt &getMergePotentialsElt()
const {
86 unsigned getHash()
const {
87 return getMergePotentialsElt().getHash();
90 return getMergePotentialsElt().getBlock();
92 bool tailIsWholeBlock()
const {
93 return TailStartPos == getBlock()->
begin();
97 getMergePotentialsElt().setBlock(MBB);
103 std::vector<SameTailElt> SameTails;
105 bool AfterBlockPlacement;
106 bool EnableTailMerge;
107 bool EnableHoistCommonCode;
109 unsigned MinCommonTailLength;
130 uint64_t getEntryFreq()
const;
138 MBFIWrapper &MBBFreqInfo;
144 unsigned MinCommonTailLength);
168 unsigned ComputeSameTails(
unsigned CurHash,
unsigned minCommonTailLength,
181 unsigned maxCommonTailLength,
182 unsigned &commonTailIndex);
186 void MergeCommonTailDebugLocs(
unsigned commonTailIndex);
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const HexagonInstrInfo * TII
static bool isSimple(Instruction *I)
TargetInstrInfo - Interface to description of machine instruction set.
unsigned const MachineRegisterInfo * MRI
LLVM Basic Block Representation.
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
MBFIWrapper(const MachineBlockFrequencyInfo &I)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
A set of physical registers with utility functions to track liveness when walking backward/forward th...
bool operator<(int64_t V1, const APSInt &V2)
This class implements an extremely fast bulk output stream that can only output to a stream...
std::string Hash(const Unit &U)
This class keeps track of branch frequencies of newly created blocks and tail-merged blocks...
This class contains meta information specific to a module.