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...
 
virtual bool is_enabled () const
 Allows concrete passes to enable/disable themselves the way they like. More...
 
- Public Member Functions inherited from cacao::jit::compiler2::Pass
 Pass ()
 
void set_PassRunner (PassRunner *pr)
 
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 Option< bool > enabled
 

Private Types

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

Additional Inherited Members

- Static Public Member Functions inherited from cacao::jit::compiler2::Pass
template<class T >
static PassInfo::IDTy ID ()
 This template will return a unique ID for each type that it is called with. More...
 

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 47 of file GlobalValueNumberingPass.hpp.

Member Typedef Documentation

Definition at line 65 of file GlobalValueNumberingPass.hpp.

Definition at line 68 of file GlobalValueNumberingPass.hpp.

Definition at line 49 of file GlobalValueNumberingPass.hpp.

Definition at line 64 of file GlobalValueNumberingPass.hpp.

Definition at line 63 of file GlobalValueNumberingPass.hpp.

Definition at line 54 of file GlobalValueNumberingPass.hpp.

Definition at line 55 of file GlobalValueNumberingPass.hpp.

typedef std::unordered_map<int32_t,BlockTy*> cacao::jit::compiler2::GlobalValueNumberingPass::IntBlockMapTy
private

Definition at line 61 of file GlobalValueNumberingPass.hpp.

typedef std::unordered_map<BlockTy*,std::vector<bool>* > cacao::jit::compiler2::GlobalValueNumberingPass::InWorkListTy
private

Definition at line 53 of file GlobalValueNumberingPass.hpp.

typedef std::unordered_map<int64_t,BlockTy*> cacao::jit::compiler2::GlobalValueNumberingPass::LongBlockMapTy
private

Definition at line 62 of file GlobalValueNumberingPass.hpp.

these types are needed for the creation of the inital blocks

Definition at line 60 of file GlobalValueNumberingPass.hpp.

Definition at line 56 of file GlobalValueNumberingPass.hpp.

Definition at line 57 of file GlobalValueNumberingPass.hpp.

Definition at line 50 of file GlobalValueNumberingPass.hpp.

Definition at line 67 of file GlobalValueNumberingPass.hpp.

Definition at line 51 of file GlobalValueNumberingPass.hpp.

Definition at line 52 of file GlobalValueNumberingPass.hpp.

Constructor & Destructor Documentation

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

Definition at line 123 of file GlobalValueNumberingPass.hpp.

Member Function Documentation

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

Definition at line 170 of file GlobalValueNumberingPass.cpp.

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

Definition at line 260 of file GlobalValueNumberingPass.cpp.

int GlobalValueNumberingPass::arity ( BlockTy block)
staticprivate

Definition at line 175 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::clean_up_operand_inverse ( )
private

Definition at line 401 of file GlobalValueNumberingPass.cpp.

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

Definition at line 181 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 163 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::eliminate_redundancies ( )
private

Definition at line 312 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::eliminate_redundancies_in_block ( BlockTy block)
private

Definition at line 322 of file GlobalValueNumberingPass.cpp.

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

Definition at line 284 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 111 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 484 of file GlobalValueNumberingPass.cpp.

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

Definition at line 279 of file GlobalValueNumberingPass.cpp.

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

Definition at line 213 of file GlobalValueNumberingPass.cpp.

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

Definition at line 241 of file GlobalValueNumberingPass.cpp.

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

Definition at line 226 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 193 of file GlobalValueNumberingPass.cpp.

virtual bool cacao::jit::compiler2::GlobalValueNumberingPass::is_enabled ( ) const
inlinevirtual

Allows concrete passes to enable/disable themselves the way they like.

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

Definition at line 127 of file GlobalValueNumberingPass.hpp.

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

Definition at line 255 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::print_block ( BlockTy block)
private

Definition at line 357 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::print_blocks ( )
private

Definition at line 367 of file GlobalValueNumberingPass.cpp.

void GlobalValueNumberingPass::print_instructions ( TouchedInstListTy instructions)
private

Definition at line 348 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 412 of file GlobalValueNumberingPass.cpp.

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

Definition at line 271 of file GlobalValueNumberingPass.cpp.

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

Definition at line 250 of file GlobalValueNumberingPass.cpp.

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

Definition at line 288 of file GlobalValueNumberingPass.cpp.

Field Documentation

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

Definition at line 73 of file GlobalValueNumberingPass.hpp.

Option< bool > GlobalValueNumberingPass::enabled
static

Definition at line 122 of file GlobalValueNumberingPass.hpp.

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

Definition at line 72 of file GlobalValueNumberingPass.hpp.

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

Definition at line 74 of file GlobalValueNumberingPass.hpp.

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

Definition at line 70 of file GlobalValueNumberingPass.hpp.

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

Definition at line 76 of file GlobalValueNumberingPass.hpp.

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

Definition at line 71 of file GlobalValueNumberingPass.hpp.

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

Definition at line 75 of file GlobalValueNumberingPass.hpp.


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