LLVM: lib/CodeGen/RegAllocGreedy.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "regalloc"
Functions
STATISTIC (NumGlobalSplits, "Number of split global live ranges")
STATISTIC (NumLocalSplits, "Number of split local live ranges")
STATISTIC (NumEvicted, "Number of interferences evicted")
INITIALIZE_PASS_BEGIN (RAGreedyLegacy, "greedy", "Greedy Register Allocator", false, false) INITIALIZE_PASS_END(RAGreedyLegacy
static unsigned getNumAllocatableRegsForConstraints (const MachineInstr *MI, Register Reg, const TargetRegisterClass *SuperRC, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI, const RegisterClassInfo &RCI)
Get the number of allocatable registers that match the constraints of Reg on MI and that are also in SuperRC.
static LaneBitmask getInstReadLaneMask (const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, const MachineInstr &FirstMI, Register Reg)
static bool readsLaneSubset (const MachineRegisterInfo &MRI, const MachineInstr *MI, const LiveInterval &VirtReg, const TargetRegisterInfo *TRI, SlotIndex Use, const TargetInstrInfo *TII)
Return true if MI at \P Use reads a subset of the lanes live in VirtReg.
static bool hasTiedDef (MachineRegisterInfo *MRI, Register reg)
Return true if reg has any tied def operand.
static bool assignedRegPartiallyOverlaps (const TargetRegisterInfo &TRI, const VirtRegMap &VRM, MCRegister PhysReg, const LiveInterval &Intf)
Return true if the existing assignment of Intf overlaps, but is not the same, as PhysReg.
Variables
static cl::opt< SplitEditor::ComplementSpillMode > SplitSpillMode ("split-spill-mode", cl::Hidden, cl::desc("Spill mode for splitting live ranges"), cl::values(clEnumValN(SplitEditor::SM_Partition, "default", "Default"), clEnumValN(SplitEditor::SM_Size, "size", "Optimize for size"), clEnumValN(SplitEditor::SM_Speed, "speed", "Optimize for speed")), cl::init(SplitEditor::SM_Speed))
static cl::opt< unsigned > LastChanceRecoloringMaxDepth ("lcr-max-depth", cl::Hidden, cl::desc("Last chance recoloring max depth"), cl::init(5))
static cl::opt< unsigned > LastChanceRecoloringMaxInterference ("lcr-max-interf", cl::Hidden, cl::desc("Last chance recoloring maximum number of considered" " interference at a time"), cl::init(8))
static cl::opt< bool > ExhaustiveSearch ("exhaustive-register-search", cl::NotHidden, cl::desc("Exhaustive Search for registers bypassing the depth " "and interference cutoffs of last chance recoloring"), cl::Hidden)
static cl::opt< unsigned > CSRFirstTimeCost ("regalloc-csr-first-time-cost", cl::desc("Cost for first time use of callee-saved register."), cl::init(0), cl::Hidden)
static cl::opt< unsigned long > GrowRegionComplexityBudget ("grow-region-complexity-budget", cl::desc("growRegion() does not scale with the number of BB edges, so " "limit its budget and bail out once we reach the limit."), cl::init(10000), cl::Hidden)
static cl::opt< bool > GreedyRegClassPriorityTrumpsGlobalness ("greedy-regclass-priority-trumps-globalness", cl::desc("Change the greedy register allocator's live range priority " "calculation to make the AllocationPriority of the register class " "more important then whether the range is global"), cl::Hidden)
static cl::opt< bool > GreedyReverseLocalAssignment ("greedy-reverse-local-assignment", cl::desc("Reverse allocation order of local live ranges, such that " "shorter local live ranges will tend to be allocated first"), cl::Hidden)
static cl::opt< unsigned > SplitThresholdForRegWithHint ("split-threshold-for-reg-with-hint", cl::desc("The threshold for splitting a virtual register with a hint, in " "percentage"), cl::init(75), cl::Hidden)
static RegisterRegAlloc greedyRegAlloc ("greedy", "greedy register allocator", createGreedyRegisterAllocator)
greedy
Greedy Register Allocator
Greedy Register false
const float Hysteresis = (2007 / 2048.0f)

DEBUG_TYPE

#define DEBUG_TYPE "regalloc"

assignedRegPartiallyOverlaps()

getInstReadLaneMask()

Definition at line 1517 of file RegAllocGreedy.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::AnalyzeVirtRegInBundle(), assert(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getSubReg(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), llvm::MachineOperand::isUndef(), llvm::MachineOperand::isUse(), MI, MRI, OpIdx, Reg, SubReg, and TRI.

Referenced by readsLaneSubset().

getNumAllocatableRegsForConstraints()

hasTiedDef()

INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( RAGreedyLegacy ,
"greedy" ,
"Greedy Register Allocator" ,
false ,
false )

readsLaneSubset()

STATISTIC() [1/3]

STATISTIC ( NumEvicted ,
"Number of interferences evicted" )

STATISTIC() [2/3]

STATISTIC ( NumGlobalSplits ,
"Number of split global live ranges" )

STATISTIC() [3/3]

STATISTIC ( NumLocalSplits ,
"Number of split local live ranges" )

Allocator

CSRFirstTimeCost

cl::opt< unsigned > CSRFirstTimeCost("regalloc-csr-first-time-cost", cl::desc("Cost for first time use of callee-saved register."), cl::init(0), cl::Hidden) ( "regalloc-csr-first-time-cost" , cl::desc("Cost for first time use of callee-saved register.") , cl::init(0) , cl::Hidden ) static

ExhaustiveSearch

cl::opt< bool > ExhaustiveSearch("exhaustive-register-search", cl::NotHidden, cl::desc("Exhaustive Search for registers bypassing the depth " "and interference cutoffs of last chance recoloring"), cl::Hidden) ( "exhaustive-register-search" , cl::NotHidden , cl::desc("Exhaustive Search for registers bypassing the depth " "and interference cutoffs of last chance recoloring") , cl::Hidden ) static

false

greedy

greedyRegAlloc

RegisterRegAlloc greedyRegAlloc("greedy", "greedy register allocator", createGreedyRegisterAllocator) ( "greedy" , "greedy register allocator" , createGreedyRegisterAllocator ) static

GreedyRegClassPriorityTrumpsGlobalness

cl::opt< bool > GreedyRegClassPriorityTrumpsGlobalness("greedy-regclass-priority-trumps-globalness", cl::desc("Change the greedy register allocator's live range priority " "calculation to make the AllocationPriority of the register class " "more important then whether the range is global"), cl::Hidden) ( "greedy-regclass-priority-trumps-globalness" , cl::desc("Change the greedy register allocator's live range priority " "calculation to make the AllocationPriority of the register class " "more important then whether the range is global") , cl::Hidden ) static

GreedyReverseLocalAssignment

cl::opt< bool > GreedyReverseLocalAssignment("greedy-reverse-local-assignment", cl::desc("Reverse allocation order of local live ranges, such that " "shorter local live ranges will tend to be allocated first"), cl::Hidden) ( "greedy-reverse-local-assignment" , cl::desc("Reverse allocation order of local live ranges, such that " "shorter local live ranges will tend to be allocated first") , cl::Hidden ) static

GrowRegionComplexityBudget

cl::opt< unsigned long > GrowRegionComplexityBudget("grow-region-complexity-budget", cl::desc("growRegion() does not scale with the number of BB edges, so " "limit its budget and bail out once we reach the limit."), cl::init(10000), cl::Hidden) ( "grow-region-complexity-budget" , cl::desc("growRegion() does not scale with the number of BB edges, so " "limit its budget and bail out once we reach the limit.") , cl::init(10000) , cl::Hidden ) static

Hysteresis

LastChanceRecoloringMaxDepth

cl::opt< unsigned > LastChanceRecoloringMaxDepth("lcr-max-depth", cl::Hidden, cl::desc("Last chance recoloring max depth"), cl::init(5)) ( "lcr-max-depth" , cl::Hidden , cl::desc("Last chance recoloring max depth") , cl::init(5) ) static

LastChanceRecoloringMaxInterference

cl::opt< unsigned > LastChanceRecoloringMaxInterference("lcr-max-interf", cl::Hidden, cl::desc("Last chance recoloring maximum number of considered" " interference at a time"), cl::init(8)) ( "lcr-max-interf" , cl::Hidden , cl::desc("Last chance recoloring maximum number of considered" " interference at a time") , cl::init(8) ) static

SplitSpillMode

cl::opt< SplitEditor::ComplementSpillMode > SplitSpillMode("split-spill-mode", cl::Hidden, cl::desc("Spill mode for splitting live ranges"), cl::values(clEnumValN(SplitEditor::SM_Partition, "default", "Default"), clEnumValN(SplitEditor::SM_Size, "size", "Optimize for size"), clEnumValN(SplitEditor::SM_Speed, "speed", "Optimize for speed")), cl::init(SplitEditor::SM_Speed)) ( "split-spill-mode" , cl::Hidden , cl::desc("Spill mode for splitting live ranges") , cl::values(clEnumValN(SplitEditor::SM_Partition, "default", "Default"), clEnumValN(SplitEditor::SM_Size, "size", "Optimize for size"), clEnumValN(SplitEditor::SM_Speed, "speed", "Optimize for speed")) , cl::init(SplitEditor::SM_Speed) ) static

SplitThresholdForRegWithHint

cl::opt< unsigned > SplitThresholdForRegWithHint("split-threshold-for-reg-with-hint", cl::desc("The threshold for splitting a virtual register with a hint, in " "percentage"), cl::init(75), cl::Hidden) ( "split-threshold-for-reg-with-hint" , cl::desc("The threshold for splitting a virtual register with a hint, in " "percentage") , cl::init(75) , cl::Hidden ) static