C-Breeze
C Compiler Infrastructure

[ Project home page]
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

briggs_reg_alloc Class Reference

#include <briggs_reg_alloc.h>

Inheritance diagram for briggs_reg_alloc:

reg_alloc List of all members.

Public Member Functions

void allocate (procNode *proc)

Protected Member Functions

template<class T> set< T > * copySet (set< T > *s)
bool interfere (WebRecord *wr, int reg)
bool liveAt (WebRecord *wr, DUChainDef def)
bool nonStore (int reg_k, int reg_l, instruction_list_p instr)
void deleteInstr (instruction_list_p instr)
int depth (instruction_list_p instr)
void makeDuChains (sduList &DuChains)
bool isSymReg (const Register &reg)
void loadSymReg (Register &reg, declNode *contents, instruction_list_p currentInstruction, instruction_list &insts)
void removeUnavailableColors (ListRecord *node, color_set &colors)
void changeWebRegister (WebRecord *web, const Register &newReg)
void makeWebs (sduList &DuChains)
void buildAdjMatrix ()
bool coalesceRegisters ()
void buildAdjLists ()
void computeSpillCosts ()
void pruneGraph ()
void adjustNeighbors (int reg)
bool assignRegisters ()
void modifyCode ()
void genSpillCode ()

Private Attributes

int num_regs
int usable_regs
int regs_reserved
int num_webs
WRVector Symreg
list< int > nodeStack
vector< int > colorToRealReg
inst_to_reg_id_map liveRegs
vector< vector< bool > > adjMatrix
LRVector adjLists
procNodeproc

Static Private Attributes

const float useWt
const float copyWt
const float defWt

Member Function Documentation

void briggs_reg_alloc::adjustNeighbors int    reg [protected]
 

Definition at line 992 of file briggs_reg_alloc.cc.

References adjLists, and int_set.

Referenced by pruneGraph().

void briggs_reg_alloc::allocate procNode   proc [virtual]
 

Implements reg_alloc.

Definition at line 1301 of file briggs_reg_alloc.cc.

References CBZ::ArchInfo, assignRegisters(), buildAdjLists(), buildAdjMatrix(), coalesceRegisters(), computeSpillCosts(), lir_flow_walker::find_loops(), genSpillCode(), arch_info::get_all_regs(), arch_info::get_regs_fpr(), arch_info::get_regs_gpr(), makeDuChains(), makeWebs(), modifyCode(), num_regs, proc, pruneGraph(), sduList, and usable_regs.

Referenced by RegAllocWalker::at_proc().

bool briggs_reg_alloc::assignRegisters   [protected]
 

Definition at line 1008 of file briggs_reg_alloc.cc.

References arch_info::register_info::_id, adjLists, CBZ::ArchInfo, colorToRealReg, arch_info::get_reg_retval_fixed(), arch_info::get_reg_retval_float(), arch_info::get_regs_fpr(), arch_info::get_regs_gpr(), ListRecord::getColor(), WebRecord::getSpill(), nodeStack, num_regs, removeUnavailableColors(), and Symreg.

Referenced by allocate().

void briggs_reg_alloc::buildAdjLists   [protected]
 

Definition at line 818 of file briggs_reg_alloc.cc.

References adjLists, adjMatrix, num_regs, and num_webs.

Referenced by allocate().

void briggs_reg_alloc::buildAdjMatrix   [protected]
 

Definition at line 680 of file briggs_reg_alloc.cc.

References arch_info::register_info::_id, adjMatrix, CBZ::ArchInfo, lir_flow_walker::computeRegisterLiveness(), DUChainDefs, DUChainDefs_p, arch_info::get_reg_fp(), arch_info::get_reg_sp(), procNode::instructions(), interfere(), liveAt(), liveRegs, num_regs, num_webs, proc, Symreg, and Register::to_string().

Referenced by allocate().

void briggs_reg_alloc::changeWebRegister WebRecord   web,
const Register   newReg
[protected]
 

Definition at line 1119 of file briggs_reg_alloc.cc.

References reg_or_const::_reg, def, LirInst::dest, DUChainDefs, WebRecord::getDefs(), WebRecord::getReg(), WebRecord::getUses(), LirInst::has_base(), LirInst::has_dest(), LirInst::has_offset(), LirInst::has_opnd1(), LirInst::has_opnd2(), LirInst::memBase, LirInst::memOffset, LirInst::nodeExtra, LirInst::opnd1, LirInst::opnd2, and use.

Referenced by coalesceRegisters(), makeWebs(), and modifyCode().

bool briggs_reg_alloc::coalesceRegisters   [protected]
 

Definition at line 765 of file briggs_reg_alloc.cc.

References adjMatrix, changeWebRegister(), deleteInstr(), LirInst::dest, LirInst::instruction, instruction_list, instruction_list_p, procNode::instructions(), isSymReg(), mn_Move, nonStore(), Register::num(), num_webs, LirInst::opnd1, proc, and Symreg.

Referenced by allocate().

void briggs_reg_alloc::computeSpillCosts   [protected]
 

Definition at line 857 of file briggs_reg_alloc.cc.

References reg_or_const::_reg, adjLists, LirInst::dest, LirInst::has_base(), LirInst::has_dest(), LirInst::has_offset(), LirInst::has_opnd1(), LirInst::has_opnd2(), LirInst::instruction, instruction_list, instruction_list_p, procNode::instructions(), LirInst::memBase, LirInst::memOffset, mn_Move, Register::num(), LirInst::opnd1, LirInst::opnd2, and proc.

Referenced by allocate().

template<class T>
set< T > * briggs_reg_alloc::copySet set< T > *    s [protected]
 

Definition at line 203 of file briggs_reg_alloc.cc.

Referenced by makeWebs().

void briggs_reg_alloc::deleteInstr instruction_list_p    instr [protected]
 

Definition at line 326 of file briggs_reg_alloc.cc.

References LirInst::block, procNode::instructions(), proc, and LirBlock::remove_inst().

Referenced by coalesceRegisters().

int briggs_reg_alloc::depth instruction_list_p    instr [protected]
 

Definition at line 337 of file briggs_reg_alloc.cc.

References LirBlock::_depth, and LirInst::block.

void briggs_reg_alloc::genSpillCode   [protected]
 

Definition at line 1194 of file briggs_reg_alloc.cc.

References reg_or_const::_reg, LirBlock::add_inst_after(), procNode::alloc_stack_local(), LirInst::block, declNode::BLOCK, DATA_CONTENTS_FRAMEP, declNode::decl_location(), LirInst::dest, LirInst::dest_contents, Register::getRegFp(), LirInst::has_base(), LirInst::has_dest(), LirInst::has_offset(), LirInst::has_opnd1(), LirInst::has_opnd2(), instruction_list, instruction_list_p, procNode::instructions(), isSymReg(), loadSymReg(), LirInst::memBase, LirInst::memBase_contents, LirInst::memOffset, LirInst::memOffset_contents, Register::num(), LirInst::opnd1, LirInst::opnd1_contents, LirInst::opnd2, LirInst::opnd2_contents, proc, declNode::storage_location(), LIR::Store(), Symreg, and declNode::type().

Referenced by allocate().

bool briggs_reg_alloc::interfere WebRecord   wr,
int    reg
[protected]
 

Definition at line 216 of file briggs_reg_alloc.cc.

References arch_info::register_info::_id, arch_info::register_info::_type, CBZ::ArchInfo, arch_info::get_all_regs(), arch_info::get_reg_fp(), arch_info::get_reg_retval_fixed(), arch_info::get_reg_retval_float(), arch_info::get_reg_sp(), Symbol::getLirVt(), WebRecord::getReg(), WebRecord::getSym(), LirInst::instruction, instruction_list, instruction_list_p, procNode::instructions(), typeNode::is_float(), typeNode::is_integer(), typeNode::is_pointer(), liveRegs, mn_Call, LirInst::nodeExtra, Register::num(), proc, reg_fpr, reg_gpr, and Node::type().

Referenced by buildAdjMatrix().

bool briggs_reg_alloc::isSymReg const Register   reg [inline, protected]
 

Definition at line 1292 of file briggs_reg_alloc.cc.

References Register::num(), num_regs, and num_webs.

Referenced by coalesceRegisters(), and genSpillCode().

bool briggs_reg_alloc::liveAt WebRecord   wr,
DUChainDef    def
[protected]
 

Definition at line 293 of file briggs_reg_alloc.cc.

References def, WebRecord::getReg(), liveRegs, and Register::num().

Referenced by buildAdjMatrix().

void briggs_reg_alloc::loadSymReg Register   reg,
declNode   contents,
instruction_list_p    currentInstruction,
instruction_list   insts
[protected]
 

Definition at line 1165 of file briggs_reg_alloc.cc.

References LirBlock::add_inst_after(), procNode::alloc_stack_local(), LirInst::block, declNode::BLOCK, DATA_CONTENTS_FRAMEP, declNode::decl_location(), Register::getRegFp(), LIR::Load(), proc, and declNode::type().

Referenced by genSpillCode().

void briggs_reg_alloc::makeDuChains sduList   DuChains [protected]
 

Definition at line 354 of file briggs_reg_alloc.cc.

References reg_or_const::_reg, CBZ::ArchInfo, def, DUChainUses, LirInst::get_dest(), arch_info::get_reg_by_index(), sdu::getDef(), lir_flow_walker::getInstructionFlowInfo(), lir_flow_walker::getInstructionsPostorder(), sdu::getUses(), LirInst::has_base(), LirInst::has_dest(), LirInst::has_offset(), LirInst::has_opnd1(), LirInst::has_opnd2(), LirInst::instruction, instruction_list, instruction_list_p, instruction_set_p, procNode::instructions(), cbz_util::list_find(), LirInst::memBase, LirInst::memOffset, mn_DeclLocal, Register::num(), num_regs, LirInst::opnd1, LirInst::opnd2, LirInst::preds, proc, and LirInst::succs.

Referenced by allocate().

void briggs_reg_alloc::makeWebs sduList   DuChains [protected]
 

Definition at line 541 of file briggs_reg_alloc.cc.

References Symbol::_reg, Symbol::_type, CBZ::ArchInfo, changeWebRegister(), copySet(), DUChainDefs, LirInst::get_dest(), arch_info::get_reg_by_index(), sdu::getDef(), WebRecord::getDefs(), WebRecord::getReg(), WebRecord::getSym(), sdu::getSymbol(), sdu::getUses(), WebRecord::getUses(), procNode::instructions(), WebRecord::intersectUses(), Register::isValid(), Register::num(), num_regs, num_webs, proc, sduList_p, Symbol::sym_reg, Symreg, WebRecord::unionDefs(), WebRecord::unionUses(), WRSet, and WRSet_p.

Referenced by allocate().

void briggs_reg_alloc::modifyCode   [protected]
 

Definition at line 1100 of file briggs_reg_alloc.cc.

References CBZ::ArchInfo, changeWebRegister(), num_regs, num_webs, and Symreg.

Referenced by allocate().

bool briggs_reg_alloc::nonStore int    reg_k,
int    reg_l,
instruction_list_p    instr
[protected]
 

Definition at line 302 of file briggs_reg_alloc.cc.

References LirInst::dest, LirInst::has_dest(), instruction_list, procNode::instructions(), Register::num(), and proc.

Referenced by coalesceRegisters().

void briggs_reg_alloc::pruneGraph   [protected]
 

Definition at line 920 of file briggs_reg_alloc.cc.

References adjLists, adjustNeighbors(), int_set, nodeStack, num_regs, num_webs, Symreg, and usable_regs.

Referenced by allocate().

void briggs_reg_alloc::removeUnavailableColors ListRecord   node,
color_set   colors
[protected]
 

Definition at line 1078 of file briggs_reg_alloc.cc.

References adjLists, ListRecord::color_none, ListRecord::getAdjNodes(), ListRecord::getRmAdjNodes(), and int_set.

Referenced by assignRegisters().


Member Data Documentation

LRVector briggs_reg_alloc::adjLists [private]
 

Definition at line 370 of file briggs_reg_alloc.h.

Referenced by adjustNeighbors(), assignRegisters(), buildAdjLists(), computeSpillCosts(), pruneGraph(), and removeUnavailableColors().

vector< vector < bool > > briggs_reg_alloc::adjMatrix [private]
 

Definition at line 368 of file briggs_reg_alloc.h.

Referenced by buildAdjLists(), buildAdjMatrix(), and coalesceRegisters().

vector< int > briggs_reg_alloc::colorToRealReg [private]
 

Definition at line 358 of file briggs_reg_alloc.h.

Referenced by assignRegisters().

const float briggs_reg_alloc::copyWt [static, private]
 

Initial value:

  1.0

Definition at line 197 of file briggs_reg_alloc.cc.

const float briggs_reg_alloc::defWt [static, private]
 

Initial value:

  1.0

Definition at line 200 of file briggs_reg_alloc.cc.

inst_to_reg_id_map briggs_reg_alloc::liveRegs [private]
 

Definition at line 362 of file briggs_reg_alloc.h.

Referenced by buildAdjMatrix(), interfere(), and liveAt().

list< int > briggs_reg_alloc::nodeStack [private]
 

Definition at line 354 of file briggs_reg_alloc.h.

Referenced by assignRegisters(), and pruneGraph().

int briggs_reg_alloc::num_regs [private]
 

Definition at line 343 of file briggs_reg_alloc.h.

Referenced by allocate(), assignRegisters(), buildAdjLists(), buildAdjMatrix(), isSymReg(), makeDuChains(), makeWebs(), modifyCode(), and pruneGraph().

int briggs_reg_alloc::num_webs [private]
 

Definition at line 348 of file briggs_reg_alloc.h.

Referenced by buildAdjLists(), buildAdjMatrix(), coalesceRegisters(), isSymReg(), makeWebs(), modifyCode(), and pruneGraph().

procNode* briggs_reg_alloc::proc [private]
 

Definition at line 374 of file briggs_reg_alloc.h.

Referenced by allocate(), buildAdjMatrix(), coalesceRegisters(), computeSpillCosts(), deleteInstr(), genSpillCode(), interfere(), loadSymReg(), makeDuChains(), makeWebs(), and nonStore().

int briggs_reg_alloc::regs_reserved [private]
 

Definition at line 346 of file briggs_reg_alloc.h.

WRVector briggs_reg_alloc::Symreg [private]
 

Definition at line 350 of file briggs_reg_alloc.h.

Referenced by assignRegisters(), buildAdjMatrix(), coalesceRegisters(), genSpillCode(), makeWebs(), modifyCode(), and pruneGraph().

int briggs_reg_alloc::usable_regs [private]
 

Definition at line 343 of file briggs_reg_alloc.h.

Referenced by allocate(), and pruneGraph().

const float briggs_reg_alloc::useWt [static, private]
 

Initial value:

  1.0

Definition at line 194 of file briggs_reg_alloc.cc.


The documentation for this class was generated from the following files:

Generated on August 27, 2003
Back to the C-Breeze home page