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

ConstantPropagationPass. More...

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

Public Member Functions

 ConstantPropagationPass ()
 
virtual bool run (JITData &JD)
 Run the Pass. More...
 
virtual PassUsageget_PassUsage (PassUsage &PA) 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_map
< Instruction *, bool >::type 
InstBoolMapTy
 
typedef alloc::unordered_map
< Instruction *, std::size_t >
::type 
InstIntMapTy
 
typedef std::list< Instruction * > WorkListTy
 

Private Member Functions

void replace_by_constant (Instruction *isnt, CONSTInst *c, Method *M)
 
void propagate (Instruction *inst)
 

Private Attributes

WorkListTy workList
 This work list is used by the algorithm to store the instructions which have to be reconsidered. More...
 
InstBoolMapTy inWorkList
 will be used to look up whether an instruction is currently contained in the worklist to avoid inserting an instruction which is already in the list More...
 
InstIntMapTy constantOperands
 used to track for each instruction the number of its operands which are already known to be constant More...
 

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

ConstantPropagationPass.

This optimization pass is a combined version of constant folding (a.k.a constant expression evaluation) and constant propagation, based on the algorithm in [8]. Analysis and program transformations in the course of this optimization are targeted at the high-level intermediate representation of the compiler2. It evalutes operations at compile-time, whose operands are all constants and propagates the results of these evaluations as far as possible through the program.

Definition at line 53 of file ConstantPropagationPass.hpp.

Member Typedef Documentation

Definition at line 55 of file ConstantPropagationPass.hpp.

Definition at line 56 of file ConstantPropagationPass.hpp.

Definition at line 57 of file ConstantPropagationPass.hpp.

Constructor & Destructor Documentation

cacao::jit::compiler2::ConstantPropagationPass::ConstantPropagationPass ( )
inline

Definition at line 83 of file ConstantPropagationPass.hpp.

Member Function Documentation

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

Set the requirements for the pass.

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

Definition at line 354 of file ConstantPropagationPass.cpp.

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

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

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

Definition at line 87 of file ConstantPropagationPass.hpp.

void ConstantPropagationPass::propagate ( Instruction inst)
private

Definition at line 250 of file ConstantPropagationPass.cpp.

void ConstantPropagationPass::replace_by_constant ( Instruction isnt,
CONSTInst c,
Method M 
)
private

Definition at line 262 of file ConstantPropagationPass.cpp.

bool ConstantPropagationPass::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 309 of file ConstantPropagationPass.cpp.

Field Documentation

InstIntMapTy cacao::jit::compiler2::ConstantPropagationPass::constantOperands
private

used to track for each instruction the number of its operands which are already known to be constant

Definition at line 76 of file ConstantPropagationPass.hpp.

Option< bool > ConstantPropagationPass::enabled
static

Definition at line 82 of file ConstantPropagationPass.hpp.

InstBoolMapTy cacao::jit::compiler2::ConstantPropagationPass::inWorkList
private

will be used to look up whether an instruction is currently contained in the worklist to avoid inserting an instruction which is already in the list

Definition at line 70 of file ConstantPropagationPass.hpp.

WorkListTy cacao::jit::compiler2::ConstantPropagationPass::workList
private

This work list is used by the algorithm to store the instructions which have to be reconsidered.

at the beginning it therefore contains all instructions.

Definition at line 64 of file ConstantPropagationPass.hpp.


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