LLVM  6.0.0svn
Macros | Functions | Variables
InlineSpiller.cpp File Reference
#include "LiveRangeCalc.h"
#include "Spiller.h"
#include "SplitKit.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/None.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/AliasAnalysis.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/LiveRangeEdit.h"
#include "llvm/CodeGen/LiveStackAnalysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/Support/BlockFrequency.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetOpcodes.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <cassert>
#include <iterator>
#include <tuple>
#include <utility>
#include <vector>
Include dependency graph for InlineSpiller.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "regalloc"
 

Functions

 STATISTIC (NumSpilledRanges, "Number of spilled live ranges")
 
 STATISTIC (NumSnippets, "Number of spilled snippets")
 
 STATISTIC (NumSpills, "Number of spills inserted")
 
 STATISTIC (NumSpillsRemoved, "Number of spills removed")
 
 STATISTIC (NumReloads, "Number of reloads inserted")
 
 STATISTIC (NumReloadsRemoved, "Number of reloads removed")
 
 STATISTIC (NumFolded, "Number of folded stack accesses")
 
 STATISTIC (NumFoldedLoads, "Number of folded loads")
 
 STATISTIC (NumRemats, "Number of rematerialized defs for spilling")
 
static unsigned isFullCopyOf (const MachineInstr &MI, unsigned Reg)
 isFullCopyOf - If MI is a COPY to or from Reg, return the other register, otherwise return 0. More...
 
static LLVM_DUMP_METHOD void dumpMachineInstrRangeWithSlotIndex (MachineBasicBlock::iterator B, MachineBasicBlock::iterator E, LiveIntervals const &LIS, const char *const header, unsigned VReg=0)
 
static bool isFullUndefDef (const MachineInstr &Def)
 Check if Def fully defines a VReg with an undefined value. More...
 

Variables

static cl::opt< boolDisableHoisting ("disable-spill-hoist", cl::Hidden, cl::desc("Disable inline spill hoisting"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "regalloc"

Definition at line 64 of file InlineSpiller.cpp.

Function Documentation

◆ dumpMachineInstrRangeWithSlotIndex()

static LLVM_DUMP_METHOD void dumpMachineInstrRangeWithSlotIndex ( MachineBasicBlock::iterator  B,
MachineBasicBlock::iterator  E,
LiveIntervals const LIS,
const char *const  header,
unsigned  VReg = 0 
)
static

◆ isFullCopyOf()

static unsigned isFullCopyOf ( const MachineInstr MI,
unsigned  Reg 
)
static

isFullCopyOf - If MI is a COPY to or from Reg, return the other register, otherwise return 0.

Definition at line 256 of file InlineSpiller.cpp.

References llvm::MachineInstr::addRegisterDead(), llvm::MachineInstr::allDefsAreDead(), llvm::MachineOperandIteratorBase::analyzeVirtReg(), assert(), llvm::MachineBasicBlock::begin(), llvm::MachineInstr::canFoldAsLoad(), llvm::dbgs(), DEBUG, llvm::VNInfo::def, DefMI, E, llvm::SmallVectorBase::empty(), llvm::MachineInstr::eraseFromParent(), llvm::SlotIndex::getBaseIndex(), llvm::MachineInstr::getDebugLoc(), llvm::MachineInstr::getNumOperands(), llvm::LiveRange::getNumValNums(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::SlotIndex::getRegSlot(), llvm::LiveRange::getVNInfoAt(), llvm::LiveRange::getVNInfoBefore(), I, llvm::VNInfo::id, llvm::MachineInstr::isCopy(), llvm::MachineInstr::isDebugValue(), llvm::MachineInstr::isFullCopy(), llvm::LiveQueryResult::isKill(), llvm::HexagonInstrInfo::isLoadFromStackSlot(), llvm::VNInfo::isPHIDef(), llvm::MachineOperand::isReg(), llvm::HexagonInstrInfo::isStoreToStackSlot(), llvm::VNInfo::isUnused(), llvm::MachineOperand::isUse(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::AMDGPUISD::KILL, LLVM_DUMP_METHOD, llvm::MachineInstr::mayStore(), MI, MRI, llvm::LiveRangeEdit::Remat::OrigMI, P, llvm::LiveRangeEdit::Remat::ParentVNI, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::MachineBasicBlock::predecessors(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::LiveRange::Query(), llvm::LiveInterval::reg, llvm::NVPTX::PTXCvtMode::RM, llvm::MachineInstr::setDesc(), llvm::MachineOperand::setIsKill(), llvm::MachineOperand::setIsUndef(), llvm::MachineOperand::setReg(), llvm::MachineBasicBlock::SkipPHIsLabelsAndDebug(), llvm::HexagonInstrInfo::storeRegToStackSlot(), TII, UseMI, llvm::LiveRange::vni_begin(), and llvm::LiveRange::vni_end().

Referenced by isFullUndefDef().

◆ isFullUndefDef()

static bool isFullUndefDef ( const MachineInstr Def)
static

Check if Def fully defines a VReg with an undefined value.

If that's the case, that means the value of VReg is actually not relevant.

Definition at line 883 of file InlineSpiller.cpp.

References Allocator, llvm::MachineOperandIteratorBase::analyzeVirtReg(), assert(), llvm::LiveRange::assign(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::begin(), llvm::SmallPtrSetImpl< PtrType >::begin(), llvm::buildDbgValueForSpill(), llvm::BuildMI(), llvm::SmallPtrSetImplBase::clear(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), DEBUG, llvm::VNInfo::def, dumpMachineInstrRangeWithSlotIndex(), E, llvm::LiveRangeEdit::eliminateDeadDefs(), llvm::SmallPtrSetImplBase::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::MachineBasicBlock::end(), llvm::SmallPtrSetImpl< PtrType >::end(), llvm::MachineInstrSpan::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::erase(), llvm::MachineBasicBlock::erase(), llvm::MachineInstr::eraseFromParent(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::DomTreeNodeBase< NodeT >::getChildren(), llvm::DomTreeNodeBase< NodeT >::getIDom(), llvm::getKillRegState(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::LiveRangeEdit::getParent(), llvm::SlotIndex::getPrevSlot(), llvm::LiveRangeEdit::getReg(), llvm::SlotIndex::getRegSlot(), llvm::MachineOperand::getSubReg(), llvm::LiveRange::getVNInfoAt(), llvm::VNInfo::id, llvm::TargetRegisterInfo::index2VirtReg(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MachineOperand::isDead(), llvm::MachineInstr::isDebugValue(), llvm::MachineOperand::isDef(), isFullCopyOf(), llvm::MachineOperand::isImplicit(), llvm::MachineInstr::isImplicitDef(), llvm::MachineOperand::isReg(), llvm::SlotIndex::isSameInstr(), llvm::LiveInterval::isSpillable(), llvm::TargetRegisterInfo::isStackSlot(), llvm::MachineOperand::isUse(), llvm::AMDGPUISD::KILL, llvm_unreachable, Loops, llvm::LiveRange::MergeValueInAsValue(), MRI, llvm::VirtRegMap::NO_STACK_SLOT, llvm::None, llvm::PrintReg(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateCommon< T >::rbegin(), llvm::LiveInterval::reg, llvm::SmallVectorTemplateCommon< T >::rend(), llvm::MachineOperand::setIsDead(), llvm::MachineOperand::setIsKill(), llvm::MachineOperand::setReg(), llvm::SmallPtrSetImplBase::size(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::HexagonInstrInfo::storeRegToStackSlot(), TII, and llvm::LiveInterval::weight.

◆ STATISTIC() [1/9]

STATISTIC ( NumSpilledRanges  ,
"Number of spilled live ranges"   
)

◆ STATISTIC() [2/9]

STATISTIC ( NumSnippets  ,
"Number of spilled snippets"   
)

◆ STATISTIC() [3/9]

STATISTIC ( NumSpills  ,
"Number of spills inserted"   
)

◆ STATISTIC() [4/9]

STATISTIC ( NumSpillsRemoved  ,
"Number of spills removed"   
)

◆ STATISTIC() [5/9]

STATISTIC ( NumReloads  ,
"Number of reloads inserted"   
)

◆ STATISTIC() [6/9]

STATISTIC ( NumReloadsRemoved  ,
"Number of reloads removed"   
)

◆ STATISTIC() [7/9]

STATISTIC ( NumFolded  ,
"Number of folded stack accesses"   
)

◆ STATISTIC() [8/9]

STATISTIC ( NumFoldedLoads  ,
"Number of folded loads"   
)

◆ STATISTIC() [9/9]

STATISTIC ( NumRemats  ,
"Number of rematerialized defs for spilling"   
)

Variable Documentation

◆ DisableHoisting

cl::opt<bool> DisableHoisting("disable-spill-hoist", cl::Hidden, cl::desc("Disable inline spill hoisting"))
static