9#ifndef LLVM_LIB_CODEGEN_BRANCHFOLDING_H
10#define LLVM_LIB_CODEGEN_BRANCHFOLDING_H
22class MachineBranchProbabilityInfo;
25class MachineRegisterInfo;
27class ProfileSummaryInfo;
29class TargetRegisterInfo;
33 explicit BranchFolder(
bool DefaultEnableTailMerge,
bool CommonHoist,
39 unsigned MinTailLength = 0);
47 bool AfterPlacement =
false);
50 class MergePotentialsElt {
56 : Hash(h), Block(b) {}
58 unsigned getHash()
const {
return Hash; }
65 bool operator<(
const MergePotentialsElt &)
const;
68 using MPIterator = std::vector<MergePotentialsElt>::iterator;
70 std::vector<MergePotentialsElt> MergePotentials;
80 : MPIter(mp), TailStartPos(tsp) {}
82 MPIterator getMPIter()
const {
86 MergePotentialsElt &getMergePotentialsElt()
const {
94 unsigned getHash()
const {
95 return getMergePotentialsElt().getHash();
99 return getMergePotentialsElt().getBlock();
102 bool tailIsWholeBlock()
const {
103 return TailStartPos == getBlock()->begin();
107 getMergePotentialsElt().setBlock(
MBB);
114 std::vector<SameTailElt> SameTails;
116 bool AfterBlockPlacement;
117 bool EnableTailMerge;
118 bool EnableHoistCommonCode;
120 unsigned MinCommonTailLength;
135 unsigned MinCommonTailLength);
159 unsigned ComputeSameTails(
unsigned CurHash,
unsigned minCommonTailLength,
172 unsigned maxCommonTailLength,
173 unsigned &commonTailIndex);
177 void mergeCommonTails(
unsigned commonTailIndex);
unsigned const MachineRegisterInfo * MRI
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library,...
This file defines the DenseMap class.
const HexagonInstrInfo * TII
bool operator<(const DeltaInfo &LHS, int64_t Delta)
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
unsigned const TargetRegisterInfo * TRI
This file defines the SmallPtrSet class.
LLVM Basic Block Representation.
A set of physical registers with utility functions to track liveness when walking backward/forward th...
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Analysis providing profile information.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
@ BasicBlock
Various leaf nodes.
This is an optimization pass for GlobalISel generic memory operations.