LLVM  5.0.0
Macros | Functions | Variables
MachineSink.cpp File Reference
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SparseBitVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachinePostDominators.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <map>
#include <utility>
#include <vector>
Include dependency graph for MachineSink.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "machine-sink"
 

Functions

 STATISTIC (NumSunk,"Number of machine instructions sunk")
 
 STATISTIC (NumSplit,"Number of critical edges split")
 
 STATISTIC (NumCoalesces,"Number of copies coalesced")
 
 INITIALIZE_PASS_BEGIN (MachineSinking, DEBUG_TYPE,"Machine code sinking", false, false) INITIALIZE_PASS_END(MachineSinking
 
static void collectDebugValues (MachineInstr &MI, SmallVectorImpl< MachineInstr * > &DbgValues)
 collectDebgValues - Scan instructions following MI and collect any matching DBG_VALUEs. More...
 
static bool SinkingPreventsImplicitNullCheck (MachineInstr &MI, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
 Return true if MI is likely to be usable as a memory operation by the implicit null check optimization. More...
 

Variables

static cl::opt< bool > SplitEdges ("machine-sink-split", cl::desc("Split critical edges during machine sinking"), cl::init(true), cl::Hidden)
 
static cl::opt< bool > UseBlockFreqInfo ("machine-sink-bfi", cl::desc("Use block frequency info to find successors to sink"), cl::init(true), cl::Hidden)
 
static cl::opt< unsigned > SplitEdgeProbabilityThreshold ("machine-sink-split-probability-threshold", cl::desc("Percentage threshold for splitting single-instruction critical edge. ""If the branch threshold is higher than this threshold, we allow ""speculative execution of up to 1 instruction to avoid branching to ""splitted critical edge"), cl::init(40), cl::Hidden)
 
 DEBUG_TYPE
 
Machine code sinking
 
Machine code false
 

Macro Definition Documentation

#define DEBUG_TYPE   "machine-sink"

Definition at line 52 of file MachineSink.cpp.

Function Documentation

static void collectDebugValues ( MachineInstr &  MI,
SmallVectorImpl< MachineInstr * > &  DbgValues 
)
static
INITIALIZE_PASS_BEGIN ( MachineSinking  ,
DEBUG_TYPE  ,
"Machine code sinking"  ,
false  ,
false   
)
static bool SinkingPreventsImplicitNullCheck ( MachineInstr &  MI,
const TargetInstrInfo *  TII,
const TargetRegisterInfo *  TRI 
)
static

Return true if MI is likely to be usable as a memory operation by the implicit null check optimization.

This is a "best effort" heuristic, and should not be relied upon for correctness. This returning true does not guarantee that the implicit null check optimization is legal over MI, and this returning false does not guarantee MI cannot possibly be used to do a null check.

Definition at line 711 of file MachineSink.cpp.

References llvm::TargetInstrInfo::analyzeBranchPredicate(), llvm::TargetInstrInfo::getMemOpBaseRegImmOfs(), llvm::MachineInstr::getParent(), llvm::MachineInstr::isPredicable(), llvm::MachineInstr::mayLoad(), llvm::LLVMContext::MD_make_implicit, llvm::MachineBasicBlock::pred_begin(), llvm::PPC::PRED_EQ, llvm::PPC::PRED_NE, and llvm::MachineBasicBlock::pred_size().

STATISTIC ( NumSunk  ,
"Number of machine instructions sunk"   
)
STATISTIC ( NumSplit  ,
"Number of critical edges split"   
)
STATISTIC ( NumCoalesces  ,
"Number of copies coalesced"   
)

Variable Documentation

DEBUG_TYPE

Definition at line 182 of file MachineSink.cpp.

Machine code false

Definition at line 182 of file MachineSink.cpp.

Machine code sinking

Definition at line 182 of file MachineSink.cpp.

cl::opt<unsigned> SplitEdgeProbabilityThreshold("machine-sink-split-probability-threshold", cl::desc("Percentage threshold for splitting single-instruction critical edge. ""If the branch threshold is higher than this threshold, we allow ""speculative execution of up to 1 instruction to avoid branching to ""splitted critical edge"), cl::init(40), cl::Hidden)
static
cl::opt<bool> SplitEdges("machine-sink-split", cl::desc("Split critical edges during machine sinking"), cl::init(true), cl::Hidden)
static
cl::opt<bool> UseBlockFreqInfo("machine-sink-bfi", cl::desc("Use block frequency info to find successors to sink"), cl::init(true), cl::Hidden)
static