LLVM  13.0.0git
Macros | Functions | Variables
TailDuplicator.cpp File Reference
#include "llvm/CodeGen/TailDuplicator.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/MachineSizeOpts.h"
#include "llvm/CodeGen/MachineSSAUpdater.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cassert>
#include <iterator>
#include <utility>
Include dependency graph for TailDuplicator.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "tailduplication"
 

Functions

 STATISTIC (NumTails, "Number of tails duplicated")
 
 STATISTIC (NumTailDups, "Number of tail duplicated blocks")
 
 STATISTIC (NumTailDupAdded, "Number of instructions added due to tail duplication")
 
 STATISTIC (NumTailDupRemoved, "Number of instructions removed due to tail duplication")
 
 STATISTIC (NumDeadBlocks, "Number of dead blocks removed")
 
 STATISTIC (NumAddedPHIs, "Number of phis added")
 
static void VerifyPHIs (MachineFunction &MF, bool CheckExtra)
 
static bool isDefLiveOut (Register Reg, MachineBasicBlock *BB, const MachineRegisterInfo *MRI)
 
static unsigned getPHISrcRegOpIdx (MachineInstr *MI, MachineBasicBlock *SrcBB)
 
static void getRegsUsedByPHIs (const MachineBasicBlock &BB, DenseSet< Register > *UsedByPhi)
 
static bool bothUsedInPHI (const MachineBasicBlock &A, const SmallPtrSet< MachineBasicBlock *, 8 > &SuccsB)
 

Variables

static cl::opt< unsigned > TailDuplicateSize ("tail-dup-size", cl::desc("Maximum instructions to consider tail duplicating"), cl::init(2), cl::Hidden)
 
static cl::opt< unsigned > TailDupIndirectBranchSize ("tail-dup-indirect-size", cl::desc("Maximum instructions to consider tail duplicating blocks that " "end with indirect branches."), cl::init(20), cl::Hidden)
 
static cl::opt< bool > TailDupVerify ("tail-dup-verify", cl::desc("Verify sanity of PHI instructions during taildup"), cl::init(false), cl::Hidden)
 
static cl::opt< unsigned > TailDupLimit ("tail-dup-limit", cl::init(~0U), cl::Hidden)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "tailduplication"

Definition at line 50 of file TailDuplicator.cpp.

Function Documentation

◆ bothUsedInPHI()

static bool bothUsedInPHI ( const MachineBasicBlock A,
const SmallPtrSet< MachineBasicBlock *, 8 > &  SuccsB 
)
static

Definition at line 692 of file TailDuplicator.cpp.

References BB, and llvm::SmallPtrSetImpl< PtrType >::count().

◆ getPHISrcRegOpIdx()

static unsigned getPHISrcRegOpIdx ( MachineInstr MI,
MachineBasicBlock SrcBB 
)
static

Definition at line 308 of file TailDuplicator.cpp.

References llvm::numbers::e, i, and MI.

Referenced by llvm::TailDuplicator::shouldTailDuplicate().

◆ getRegsUsedByPHIs()

static void getRegsUsedByPHIs ( const MachineBasicBlock BB,
DenseSet< Register > *  UsedByPhi 
)
static

◆ isDefLiveOut()

static bool isDefLiveOut ( Register  Reg,
MachineBasicBlock BB,
const MachineRegisterInfo MRI 
)
static

Definition at line 297 of file TailDuplicator.cpp.

References BB, MRI, Reg, llvm::MachineRegisterInfo::use_instructions(), and UseMI.

◆ STATISTIC() [1/6]

STATISTIC ( NumAddedPHIs  ,
"Number of phis added"   
)

◆ STATISTIC() [2/6]

STATISTIC ( NumDeadBlocks  ,
"Number of dead blocks removed  
)

◆ STATISTIC() [3/6]

STATISTIC ( NumTailDupAdded  ,
"Number of instructions added due to tail duplication"   
)

◆ STATISTIC() [4/6]

STATISTIC ( NumTailDupRemoved  ,
"Number of instructions removed due to tail duplication"   
)

◆ STATISTIC() [5/6]

STATISTIC ( NumTailDups  ,
"Number of tail duplicated blocks"   
)

◆ STATISTIC() [6/6]

STATISTIC ( NumTails  ,
"Number of tails duplicated"   
)

◆ VerifyPHIs()

static void VerifyPHIs ( MachineFunction MF,
bool  CheckExtra 
)
static

Variable Documentation

◆ TailDupIndirectBranchSize

cl::opt<unsigned> TailDupIndirectBranchSize("tail-dup-indirect-size", cl::desc("Maximum instructions to consider tail duplicating blocks that " "end with indirect branches."), cl::init(20), cl::Hidden)
static

◆ TailDuplicateSize

cl::opt<unsigned> TailDuplicateSize("tail-dup-size", cl::desc("Maximum instructions to consider tail duplicating"), cl::init(2), cl::Hidden)
static

◆ TailDupLimit

cl::opt<unsigned> TailDupLimit("tail-dup-limit", cl::init(~0U), cl::Hidden)
static

◆ TailDupVerify

cl::opt<bool> TailDupVerify("tail-dup-verify", cl::desc("Verify sanity of PHI instructions during taildup"), cl::init(false), cl::Hidden)
static