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...
 
- 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_map
< Instruction *, bool > 
InstBoolMapTy
 
typedef unordered_map
< Instruction *, std::size_t > 
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...
 

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 52 of file ConstantPropagationPass.hpp.

Member Typedef Documentation

Definition at line 54 of file ConstantPropagationPass.hpp.

Definition at line 55 of file ConstantPropagationPass.hpp.

Definition at line 56 of file ConstantPropagationPass.hpp.

Constructor & Destructor Documentation

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

Definition at line 82 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 353 of file ConstantPropagationPass.cpp.

void ConstantPropagationPass::propagate ( Instruction inst)
private

Definition at line 249 of file ConstantPropagationPass.cpp.

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

Definition at line 261 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 308 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 75 of file ConstantPropagationPass.hpp.

char ConstantPropagationPass::ID = 0
static

Definition at line 81 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 69 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 63 of file ConstantPropagationPass.hpp.


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