LLVM API Documentation

RegAllocLinearScan.cpp File Reference

#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "PhysRegTracker.h"
#include "VirtRegMap.h"
#include "llvm/Function.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/SSARegMap.h"
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/EquivalenceClasses.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <queue>
#include <memory>

Include dependency graph for RegAllocLinearScan.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "regalloc"

Typedefs

typedef std::pair< LiveInterval *,
LiveInterval::iterator
IntervalPtr
typedef std::vector< IntervalPtrIntervalPtrs
typedef std::priority_queue<
LiveInterval *, std::vector<
LiveInterval * >, greater_ptr<
LiveInterval > > 
IntervalHeap

Functions

static void updateSpillWeights (std::vector< float > &Weights, unsigned reg, float weight, const MRegisterInfo *MRI)
static RA::IntervalPtrs::iterator FindIntervalInVector (RA::IntervalPtrs &IP, LiveInterval *LI)
static void RevertVectorIteratorsTo (RA::IntervalPtrs &V, unsigned Point)
FunctionPassllvm::createLinearScanRegisterAllocator ()

Variables

Statistic< double > efficiency ("regalloc","Ratio of intervals processed over total intervals")
Statistic NumBacktracks ("regalloc","Number of times we had to backtrack")
static unsigned numIterations = 0
static unsigned numIntervals = 0
EquivalenceClasses< const
TargetRegisterClass * > 
RelatedRegClasses
std::map< unsigned, const
TargetRegisterClass * > 
OneClassForEachPhysReg
MachineFunctionmf_
const TargetMachinetm_
const MRegisterInfomri_
LiveIntervalsli_
bool * PhysRegsUsed
std::vector< LiveInterval * > handled_
IntervalPtrs fixed_
IntervalPtrs active_
IntervalPtrs inactive_
IntervalHeap unhandled_
std::auto_ptr< PhysRegTrackerprt_
std::auto_ptr< VirtRegMapvrm_
std::auto_ptr< Spillerspiller_


Define Documentation

#define DEBUG_TYPE   "regalloc"

Definition at line 14 of file RegAllocLinearScan.cpp.


Typedef Documentation

typedef std::priority_queue<LiveInterval*, std::vector<LiveInterval*>, greater_ptr<LiveInterval> > IntervalHeap

Definition at line 80 of file RegAllocLinearScan.cpp.

typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr

Definition at line 47 of file RegAllocLinearScan.cpp.

typedef std::vector<IntervalPtr> IntervalPtrs

Definition at line 48 of file RegAllocLinearScan.cpp.


Function Documentation

static RA::IntervalPtrs::iterator FindIntervalInVector ( RA::IntervalPtrs IP,
LiveInterval LI 
) [static]

Definition at line 392 of file RegAllocLinearScan.cpp.

References E, I, and LI.

static void RevertVectorIteratorsTo ( RA::IntervalPtrs V,
unsigned  Point 
) [static]

Definition at line 399 of file RegAllocLinearScan.cpp.

References I.

static void updateSpillWeights ( std::vector< float > &  Weights,
unsigned  reg,
float  weight,
const MRegisterInfo MRI 
) [static]

updateSpillWeights - updates the spill weights of the specifed physical register and its weight.

Definition at line 384 of file RegAllocLinearScan.cpp.

References llvm::MRegisterInfo::getAliasSet(), and MRI.


Variable Documentation

IntervalPtrs active_

active_ - Intervals that are currently being processed, and which have a live range active for the current point.

Definition at line 72 of file RegAllocLinearScan.cpp.

Statistic<double> efficiency("regalloc","Ratio of intervals processed over total intervals") [static]

IntervalPtrs fixed_

fixed_ - Intervals that correspond to machine registers.

Definition at line 68 of file RegAllocLinearScan.cpp.

std::vector<LiveInterval*> handled_

handled_ - Intervals are added to the handled_ set in the order of their start value. This is uses for backtracking.

Definition at line 64 of file RegAllocLinearScan.cpp.

IntervalPtrs inactive_

inactive_ - Intervals that are currently being processed, but which have a hold at the current point.

Definition at line 76 of file RegAllocLinearScan.cpp.

LiveIntervals* li_

Definition at line 59 of file RegAllocLinearScan.cpp.

MachineFunction* mf_

Definition at line 56 of file RegAllocLinearScan.cpp.

const MRegisterInfo* mri_

Definition at line 58 of file RegAllocLinearScan.cpp.

Statistic NumBacktracks("regalloc","Number of times we had to backtrack") [static]

unsigned numIntervals = 0 [static]

Definition at line 44 of file RegAllocLinearScan.cpp.

unsigned numIterations = 0 [static]

Definition at line 43 of file RegAllocLinearScan.cpp.

std::map<unsigned, const TargetRegisterClass*> OneClassForEachPhysReg

Definition at line 54 of file RegAllocLinearScan.cpp.

bool* PhysRegsUsed

Definition at line 60 of file RegAllocLinearScan.cpp.

std::auto_ptr<PhysRegTracker> prt_

Definition at line 82 of file RegAllocLinearScan.cpp.

EquivalenceClasses<const TargetRegisterClass*> RelatedRegClasses

RelatedRegClasses - This structure is built the first time a function is compiled, and keeps track of which register classes have registers that belong to multiple classes or have aliases that are in other classes.

Definition at line 53 of file RegAllocLinearScan.cpp.

std::auto_ptr<Spiller> spiller_

Definition at line 84 of file RegAllocLinearScan.cpp.

const TargetMachine* tm_

Definition at line 57 of file RegAllocLinearScan.cpp.

IntervalHeap unhandled_

Definition at line 81 of file RegAllocLinearScan.cpp.

std::auto_ptr<VirtRegMap> vrm_

Definition at line 83 of file RegAllocLinearScan.cpp.