LLVM  6.0.0svn
Macros | Functions | Variables
MachineSink.cpp File Reference
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.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/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/Pass.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.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< boolSplitEdges ("machine-sink-split", cl::desc("Split critical edges during machine sinking"), cl::init(true), cl::Hidden)
 
static cl::opt< boolUseBlockFreqInfo ("machine-sink-bfi", cl::desc("Use block frequency info to find successors to sink"), cl::init(true), cl::Hidden)
 
static cl::opt< unsignedSplitEdgeProbabilityThreshold ("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

◆ DEBUG_TYPE

#define DEBUG_TYPE   "machine-sink"

Definition at line 56 of file MachineSink.cpp.

Function Documentation

◆ collectDebugValues()

static void collectDebugValues ( MachineInstr MI,
SmallVectorImpl< MachineInstr *> &  DbgValues 
)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( MachineSinking  ,
DEBUG_TYPE  ,
"Machine code sinking ,
false  ,
false   
)

◆ SinkingPreventsImplicitNullCheck()

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 718 of file MachineSink.cpp.

References llvm::TargetInstrInfo::analyzeBranchPredicate(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::MachineBasicBlock::begin(), collectDebugValues(), llvm::dbgs(), DEBUG, llvm::MachineDominatorTree::dominates(), E, llvm::MachineBasicBlock::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::getDebugLoc(), llvm::TargetInstrInfo::getMemOpBaseRegImmOfs(), llvm::DILocation::getMergedLocation(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), I, llvm::MachineInstr::isConvergent(), llvm::MachineBasicBlock::isLiveIn(), llvm::MachineLoopInfo::isLoopHeader(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineInstr::isPredicable(), llvm::MachineOperand::isReg(), llvm::MachineInstr::isSafeToMove(), llvm::MachineInstr::mayLoad(), llvm::LLVMContext::MD_make_implicit, llvm::MachineInstr::operands(), llvm::MachineBasicBlock::pred_begin(), llvm::PPC::PRED_EQ, llvm::PPC::PRED_NE, llvm::MachineBasicBlock::pred_size(), llvm::SparseBitVector< ElementSize >::set(), llvm::MachineInstr::setDebugLoc(), llvm::TargetInstrInfo::shouldSink(), SinkInstruction(), and llvm::MachineBasicBlock::splice().

◆ STATISTIC() [1/3]

STATISTIC ( NumSunk  ,
"Number of machine instructions sunk"   
)

◆ STATISTIC() [2/3]

STATISTIC ( NumSplit  ,
"Number of critical edges split  
)

◆ STATISTIC() [3/3]

STATISTIC ( NumCoalesces  ,
"Number of copies coalesced"   
)

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 190 of file MachineSink.cpp.

◆ false

Machine code false

Definition at line 190 of file MachineSink.cpp.

◆ sinking

Machine code sinking

Definition at line 190 of file MachineSink.cpp.

◆ SplitEdgeProbabilityThreshold

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

◆ SplitEdges

cl::opt<bool> SplitEdges("machine-sink-split", cl::desc("Split critical edges during machine sinking"), cl::init(true), cl::Hidden)
static

◆ UseBlockFreqInfo

cl::opt<bool> UseBlockFreqInfo("machine-sink-bfi", cl::desc("Use block frequency info to find successors to sink"), cl::init(true), cl::Hidden)
static