CACAO
Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
cacao::jit::compiler2::GlobalValueNumberingPass Class Reference

GlobalValueNumberingPass. More...

Inheritance diagram for cacao::jit::compiler2::GlobalValueNumberingPass:
cacao::jit::compiler2::Pass

Public Member Functions

 GlobalValueNumberingPass ()
 
virtual bool run (JITData &JD)
 Run the Pass. More...
 
virtual PassUsageget_PassUsage (PassUsage &PU) const
 Set the requirements for the pass. More...
 
- Public Member Functions inherited from cacao::jit::compiler2::Pass
 Pass ()
 
void set_PassManager (PassManager *PM)
 
template<class _PassClass >
_PassClass * get_Pass () const
 Get the result of a previous compiler pass. More...
 
template<class _PassClass >
_PassClass * get_Pass_if_available () const
 Get the result of a previous compiler pass. More...
 
virtual void initialize ()
 Initialize the Pass. More...
 
virtual void finalize ()
 Finalize the Pass. More...
 
virtual bool verify () const
 Verify the Result. More...
 
virtual ~Pass ()
 Destructor. More...
 

Static Public Attributes

static char ID = 0
 

Private Types

typedef unordered_set
< Instruction * > 
BlockTy
 
typedef std::list< BlockTy * > PartitionTy
 
typedef std::pair< BlockTy *, int > WorkListPairTy
 
typedef std::list
< WorkListPairTy * > 
WorkListTy
 
typedef unordered_map< BlockTy
*, std::vector< bool > * > 
InWorkListTy
 
typedef unordered_map
< Instruction *, BlockTy * > 
Inst2BlockMapTy
 
typedef std::list< Instruction * > InstructionListTy
 
typedef std::vector
< InstructionListTy * > 
OperandIndex2UsersTy
 
typedef unordered_map
< Instruction
*, OperandIndex2UsersTy * > 
OperandInverseMapTy
 
typedef unordered_map
< Instruction::InstID, BlockTy
*, hash< int > > 
OpcodeBlockMapTy
 these types are needed for the creation of the inital blocks More...
 
typedef unordered_map< int32_t,
BlockTy * > 
IntBlockMapTy
 
typedef unordered_map< int64_t,
BlockTy * > 
LongBlockMapTy
 
typedef unordered_map< float,
BlockTy * > 
FloatBlockMapTy
 
typedef unordered_map< double,
BlockTy * > 
DoubleBlockMapTy
 
typedef unordered_map
< BeginInst *, BlockTy * > 
BBBlockMapTy
 
typedef unordered_set
< Instruction * > 
TouchedInstListTy
 
typedef unordered_map< BlockTy
*, TouchedInstListTy * > 
Block2TouchedInstListMapTy
 

Private Member Functions

BlockTycreate_block ()
 creates and returns a new block and does some setup work needed for the further execution of the partitioning algorithm More...
 
void init_partition (Method::const_iterator begin, Method::const_iterator end)
 
void init_worklist_and_touchedblocks ()
 
void init_operand_inverse (Method::const_iterator begin, Method::const_iterator end)
 
InstructionListTyget_users (Instruction *inst, int op_index)
 
void add_to_block (BlockTy *block, Instruction *inst)
 
void add_to_worklist (BlockTy *block, int operandIndex)
 
std::vector< bool > * get_worklist_flags (BlockTy *block)
 
void set_in_worklist (BlockTy *block, int index, bool flag)
 
bool is_in_worklist (BlockTy *block, int index)
 
WorkListPairTyselectAndDeleteFromWorkList ()
 
TouchedInstListTyget_touched_instructions (BlockTy *block)
 
BlockTyget_block (Instruction *inst)
 
void split (BlockTy *block, TouchedInstListTy *instructions)
 
void print_block (BlockTy *block)
 
void print_blocks ()
 
void print_instructions (TouchedInstListTy *instructions)
 
void eliminate_redundancies ()
 
void eliminate_redundancies_in_block (BlockTy *block)
 
template<typename T1 , typename T2 >
BlockTyget_or_create_block (T1 &map, T2 key)
 
void clean_up_operand_inverse ()
 

Static Private Member Functions

static int arity (BlockTy *block)
 
static int compute_max_arity (Method::const_iterator begin, Method::const_iterator end)
 

Private Attributes

int max_arity
 
PartitionTy partition
 
Inst2BlockMapTy inst2BlockMap
 
Block2TouchedInstListMapTy block2TouchedInstListMap
 
InWorkListTy inWorkList
 
WorkListTy workList
 
OperandInverseMapTy operandInverseMap
 

Detailed Description

GlobalValueNumberingPass.

This pass finds and removes redundant computations based on the high-level intermediate representation of the compiler2, i.e., it removes redundant nodes. It therefore uses the global value numbering algorithm in [8].

Definition at line 46 of file GlobalValueNumberingPass.hpp.

Member Typedef Documentation

Definition at line 64 of file GlobalValueNumberingPass.hpp.

Definition at line 67 of file GlobalValueNumberingPass.hpp.

Definition at line 48 of file GlobalValueNumberingPass.hpp.

Definition at line 63 of file GlobalValueNumberingPass.hpp.

Definition at line 62 of file GlobalValueNumberingPass.hpp.

Definition at line 53 of file GlobalValueNumberingPass.hpp.

Definition at line 54 of file GlobalValueNumberingPass.hpp.

Definition at line 60 of file GlobalValueNumberingPass.hpp.

Definition at line 52 of file GlobalValueNumberingPass.hpp.

Definition at line 61 of file GlobalValueNumberingPass.hpp.

these types are needed for the creation of the inital blocks

Definition at line 59 of file GlobalValueNumberingPass.hpp.

Definition at line 55 of file GlobalValueNumberingPass.hpp.

Definition at line 56 of file GlobalValueNumberingPass.hpp.

Definition at line 49 of file GlobalValueNumberingPass.hpp.

Definition at line 66 of file GlobalValueNumberingPass.hpp.

Definition at line 50 of file GlobalValueNumberingPass.hpp.

Definition at line 51 of file GlobalValueNumberingPass.hpp.

Constructor & Destructor Documentation

cacao::jit::compiler2::GlobalValueNumberingPass::GlobalValueNumberingPass ( )
inline

Definition at line 122 of file GlobalValueNumberingPass.hpp.

Member Function Documentation

void GlobalValueNumberingPass::add_to_block ( BlockTy block,
Instruction inst 
)
private

Definition at line 164 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::add_to_worklist ( BlockTy block,
int  operandIndex 
)
private

Definition at line 254 of file GlobalValueNumberingPass.cpp.

int GlobalValueNumberingPass::arity ( BlockTy block)
staticprivate

Definition at line 169 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::clean_up_operand_inverse ( )
private

Definition at line 398 of file GlobalValueNumberingPass.cpp.

int GlobalValueNumberingPass::compute_max_arity ( Method::const_iterator  begin,
Method::const_iterator  end 
)
staticprivate

Definition at line 175 of file GlobalValueNumberingPass.cpp.

GlobalValueNumberingPass::BlockTy * GlobalValueNumberingPass::create_block ( )
private

creates and returns a new block and does some setup work needed for the further execution of the partitioning algorithm

Definition at line 157 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::eliminate_redundancies ( )
private

Definition at line 306 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::eliminate_redundancies_in_block ( BlockTy block)
private

Definition at line 316 of file GlobalValueNumberingPass.cpp.

GlobalValueNumberingPass::BlockTy * GlobalValueNumberingPass::get_block ( Instruction inst)
private

Definition at line 278 of file GlobalValueNumberingPass.cpp.

template<typename T1 , typename T2 >
BlockTy* cacao::jit::compiler2::GlobalValueNumberingPass::get_or_create_block ( T1 &  map,
T2  key 
)
inlineprivate

Definition at line 110 of file GlobalValueNumberingPass.hpp.

PassUsage & GlobalValueNumberingPass::get_PassUsage ( PassUsage PU) const
virtual

Set the requirements for the pass.

Reimplemented from cacao::jit::compiler2::Pass.

Definition at line 481 of file GlobalValueNumberingPass.cpp.

GlobalValueNumberingPass::TouchedInstListTy * GlobalValueNumberingPass::get_touched_instructions ( BlockTy block)
private

Definition at line 273 of file GlobalValueNumberingPass.cpp.

GlobalValueNumberingPass::InstructionListTy * GlobalValueNumberingPass::get_users ( Instruction inst,
int  op_index 
)
private

Definition at line 207 of file GlobalValueNumberingPass.cpp.

std::vector< bool > * GlobalValueNumberingPass::get_worklist_flags ( BlockTy block)
private

Definition at line 235 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::init_operand_inverse ( Method::const_iterator  begin,
Method::const_iterator  end 
)
private

Definition at line 220 of file GlobalValueNumberingPass.cpp.

void cacao::jit::compiler2::GlobalValueNumberingPass::init_partition ( Method::const_iterator  begin,
Method::const_iterator  end 
)
private
void GlobalValueNumberingPass::init_worklist_and_touchedblocks ( )
private

Definition at line 187 of file GlobalValueNumberingPass.cpp.

bool GlobalValueNumberingPass::is_in_worklist ( BlockTy block,
int  index 
)
private

Definition at line 249 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::print_block ( BlockTy block)
private

Definition at line 354 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::print_blocks ( )
private

Definition at line 364 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::print_instructions ( TouchedInstListTy instructions)
private

Definition at line 345 of file GlobalValueNumberingPass.cpp.

bool GlobalValueNumberingPass::run ( JITData JD)
virtual

Run the Pass.

This method implements the compiler pass.

Returns
false if a problem occurred, true otherwise

Implements cacao::jit::compiler2::Pass.

Definition at line 409 of file GlobalValueNumberingPass.cpp.

GlobalValueNumberingPass::WorkListPairTy * GlobalValueNumberingPass::selectAndDeleteFromWorkList ( )
private

Definition at line 265 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::set_in_worklist ( BlockTy block,
int  index,
bool  flag 
)
private

Definition at line 244 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::split ( BlockTy block,
TouchedInstListTy instructions 
)
private

Definition at line 282 of file GlobalValueNumberingPass.cpp.

Field Documentation

Block2TouchedInstListMapTy cacao::jit::compiler2::GlobalValueNumberingPass::block2TouchedInstListMap
private

Definition at line 72 of file GlobalValueNumberingPass.hpp.

char GlobalValueNumberingPass::ID = 0
static

Definition at line 121 of file GlobalValueNumberingPass.hpp.

Inst2BlockMapTy cacao::jit::compiler2::GlobalValueNumberingPass::inst2BlockMap
private

Definition at line 71 of file GlobalValueNumberingPass.hpp.

InWorkListTy cacao::jit::compiler2::GlobalValueNumberingPass::inWorkList
private

Definition at line 73 of file GlobalValueNumberingPass.hpp.

int cacao::jit::compiler2::GlobalValueNumberingPass::max_arity
private

Definition at line 69 of file GlobalValueNumberingPass.hpp.

OperandInverseMapTy cacao::jit::compiler2::GlobalValueNumberingPass::operandInverseMap
private

Definition at line 75 of file GlobalValueNumberingPass.hpp.

PartitionTy cacao::jit::compiler2::GlobalValueNumberingPass::partition
private

Definition at line 70 of file GlobalValueNumberingPass.hpp.

WorkListTy cacao::jit::compiler2::GlobalValueNumberingPass::workList
private

Definition at line 74 of file GlobalValueNumberingPass.hpp.


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