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 {
57 : Hash(h), Block(b), BranchDebugLoc(std::move(bdl)) {}
59 unsigned getHash()
const {
return Hash; }
68 bool operator<(
const MergePotentialsElt &)
const;
71 using MPIterator = std::vector<MergePotentialsElt>::iterator;
73 std::vector<MergePotentialsElt> MergePotentials;
83 : MPIter(mp), TailStartPos(tsp) {}
85 MPIterator getMPIter()
const {
89 MergePotentialsElt &getMergePotentialsElt()
const {
97 unsigned getHash()
const {
98 return getMergePotentialsElt().getHash();
102 return getMergePotentialsElt().getBlock();
105 bool tailIsWholeBlock()
const {
106 return TailStartPos == getBlock()->begin();
110 getMergePotentialsElt().setBlock(
MBB);
117 std::vector<SameTailElt> SameTails;
119 bool AfterBlockPlacement =
false;
120 bool EnableTailMerge =
false;
121 bool EnableHoistCommonCode =
false;
122 bool UpdateLiveIns =
false;
123 unsigned MinCommonTailLength;
138 unsigned MinCommonTailLength);
162 unsigned ComputeSameTails(
unsigned CurHash,
unsigned minCommonTailLength,
176 unsigned maxCommonTailLength,
177 unsigned &commonTailIndex);
181 void mergeCommonTails(
unsigned commonTailIndex);
unsigned const MachineRegisterInfo * MRI
static DebugLoc getBranchDebugLoc(MachineBasicBlock &MBB)
getBranchDebugLoc - Find and return, if any, the DebugLoc of the branch instructions on the block.
#define LLVM_LIBRARY_VISIBILITY
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.