CACAO
Public Member Functions | Private Member Functions | Private Attributes
cacao::jit::compiler2::SSAConstructionPass Class Reference

SSAConstructionPass. More...

Inheritance diagram for cacao::jit::compiler2::SSAConstructionPass:
cacao::jit::compiler2::Pass cacao::jit::compiler2::memory::ManagerMixin< SSAConstructionPass >

Public Member Functions

Valueread_variable (size_t varindex, size_t bb)
 
 SSAConstructionPass ()
 
virtual bool run (JITData &JD)
 Run the Pass. More...
 
virtual bool verify () const
 Verify the Result. 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_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 bool is_enabled () const
 Allows concrete passes to enable/disable themselves the way they like. More...
 
virtual void initialize ()
 Initialize the Pass. More...
 
virtual void finalize ()
 Finalize the Pass. More...
 
virtual ~Pass ()
 Destructor. More...
 

Private Member Functions

void write_variable (size_t varindex, size_t bb, Value *V)
 
Valueread_variable_recursive (size_t varindex, size_t bb)
 
Valueadd_phi_operands (size_t varindex, PHIInst *phi)
 
Valuetry_remove_trivial_phi (PHIInst *phi)
 
void seal_block (size_t bb)
 
bool try_seal_block (basicblock *bb)
 
void print_current_def () const
 
bool skipped_all_predecessors (basicblock *bb)
 Check whether all predecessor blocks of bb have been skipped. More...
 
void remove_unreachable_blocks ()
 Remove unreachable BeginInsts and their corresponding EndInsts. More...
 
void deoptimize (int bbindex)
 Helper function to terminate a block with a DeoptimizeInst. More...
 
void install_javalocal_dependencies (SourceStateInst *source_state, s4 *javalocals, basicblock *bb)
 
void install_stackvar_dependencies (SourceStateInst *source_state, s4 *stack, s4 stackdepth, s4 paramcount, basicblock *bb)
 
SourceStateInstrecord_source_state (Instruction *I, instruction *iptr, basicblock *bb, s4 *javalocals, s4 *stack, s4 stackdepth)
 
CONSTInstparse_s2_constant (instruction *iptr, Type::TypeID type)
 Creates a CONSTInst of type type from the s2 operand of iptr. More...
 

Private Attributes

MethodM
 
jitdatajd
 
alloc::vector< BeginInst * >::type BB
 
alloc::unordered_map
< BeginInst *, size_t >::type 
beginToIndex
 
alloc::vector< alloc::vector
< Value * >::type >::type 
current_def
 
alloc::vector< alloc::vector
< PHIInst * >::type >::type 
incomplete_phi
 
alloc::vector< alloc::list
< InVarPhis * >::type >::type 
incomplete_in_phi
 
alloc::vector< bool >::type sealed_blocks
 
alloc::vector< bool >::type filled_blocks
 
alloc::vector< bool >::type visited_blocks
 Used to remember which basicblocks have already been visited. More...
 
alloc::vector< bool >::type skipped_blocks
 Indicates whether IR construction should be skipped for a basicblock. More...
 
alloc::vector< Type::TypeID >::type var_type_tbl
 

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...
 
- Static Public Member Functions inherited from cacao::jit::compiler2::memory::ManagerMixin< SSAConstructionPass >
static voidoperator new (std::size_t size) throw (std::bad_alloc)
 normal new More...
 
static voidoperator new (std::size_t size, void *ptr) throw ()
 placement new More...
 
static voidoperator new (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new More...
 
static void operator delete (void *pMemory) throw ()
 normal delete More...
 
static void operator delete (void *pMemory, void *ptr) throw ()
 placement delete More...
 
static void operator delete (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete More...
 
static voidoperator new[] (std::size_t size) throw (std::bad_alloc)
 normal new[] More...
 
static voidoperator new[] (std::size_t size, void *ptr) throw ()
 placement new[] More...
 
static voidoperator new[] (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new[] More...
 
static void operator delete[] (void *pMemory) throw ()
 normal delete[] More...
 
static void operator delete[] (void *pMemory, void *ptr) throw ()
 placement delete[] More...
 
static void operator delete[] (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete[] More...
 

Detailed Description

SSAConstructionPass.

This Pass constructs the compiler2 specific SSA based IR from the ICMD_* style IR used in the baseline compiler.

The approach is based on "Simple and Efficient Construction of Static Singe Assignment Form" by Braun et al. 2013 [1].

Definition at line 52 of file SSAConstructionPass.hpp.

Constructor & Destructor Documentation

cacao::jit::compiler2::SSAConstructionPass::SSAConstructionPass ( )
inline

Definition at line 127 of file SSAConstructionPass.hpp.

Member Function Documentation

Value* cacao::jit::compiler2::SSAConstructionPass::add_phi_operands ( size_t  varindex,
PHIInst phi 
)
private
void cacao::jit::compiler2::SSAConstructionPass::deoptimize ( int  bbindex)
private

Helper function to terminate a block with a DeoptimizeInst.

Assigns a new DeoptimizeInst to the BeginInst that corresponds to the given bbindex. Additionally the corresponding skipped_blocks flag is set to true in order to signal that IR construction should be skipped for the rest of this block.

Parameters
bbindexThe corresponding basicblock index.
virtual PassUsage& cacao::jit::compiler2::SSAConstructionPass::get_PassUsage ( PassUsage PU) const
virtual

Set the requirements for the pass.

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

void cacao::jit::compiler2::SSAConstructionPass::install_javalocal_dependencies ( SourceStateInst source_state,
s4 javalocals,
basicblock bb 
)
private
void cacao::jit::compiler2::SSAConstructionPass::install_stackvar_dependencies ( SourceStateInst source_state,
s4 stack,
s4  stackdepth,
s4  paramcount,
basicblock bb 
)
private
CONSTInst* cacao::jit::compiler2::SSAConstructionPass::parse_s2_constant ( instruction iptr,
Type::TypeID  type 
)
private

Creates a CONSTInst of type type from the s2 operand of iptr.

Parameters
iptrThe corresponding baseline IR instruction.
typeThe corresponding type.
Returns
The new CONSTInst.
void cacao::jit::compiler2::SSAConstructionPass::print_current_def ( ) const
private
Value* cacao::jit::compiler2::SSAConstructionPass::read_variable ( size_t  varindex,
size_t  bb 
)
Value* cacao::jit::compiler2::SSAConstructionPass::read_variable_recursive ( size_t  varindex,
size_t  bb 
)
private
SourceStateInst* cacao::jit::compiler2::SSAConstructionPass::record_source_state ( Instruction I,
instruction iptr,
basicblock bb,
s4 javalocals,
s4 stack,
s4  stackdepth 
)
private
void cacao::jit::compiler2::SSAConstructionPass::remove_unreachable_blocks ( )
private

Remove unreachable BeginInsts and their corresponding EndInsts.

virtual bool cacao::jit::compiler2::SSAConstructionPass::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.

void cacao::jit::compiler2::SSAConstructionPass::seal_block ( size_t  bb)
private
bool cacao::jit::compiler2::SSAConstructionPass::skipped_all_predecessors ( basicblock bb)
private

Check whether all predecessor blocks of bb have been skipped.

Parameters
bbThe block to check.
Returns
True if all predecessors have been skipped, false otherwise.
Value* cacao::jit::compiler2::SSAConstructionPass::try_remove_trivial_phi ( PHIInst phi)
private
bool cacao::jit::compiler2::SSAConstructionPass::try_seal_block ( basicblock bb)
private
virtual bool cacao::jit::compiler2::SSAConstructionPass::verify ( ) const
virtual

Verify the Result.

This method is used to verify the result of the pass. It has the same motivation than the assert() statement. It should be only used for debugging purposes and might not be called in release builds.

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

void cacao::jit::compiler2::SSAConstructionPass::write_variable ( size_t  varindex,
size_t  bb,
Value V 
)
private

Field Documentation

alloc::vector<BeginInst*>::type cacao::jit::compiler2::SSAConstructionPass::BB
private

Definition at line 56 of file SSAConstructionPass.hpp.

alloc::unordered_map<BeginInst*,size_t>::type cacao::jit::compiler2::SSAConstructionPass::beginToIndex
private

Definition at line 57 of file SSAConstructionPass.hpp.

alloc::vector<alloc::vector<Value*>::type >::type cacao::jit::compiler2::SSAConstructionPass::current_def
private

Definition at line 58 of file SSAConstructionPass.hpp.

alloc::vector<bool>::type cacao::jit::compiler2::SSAConstructionPass::filled_blocks
private

Definition at line 65 of file SSAConstructionPass.hpp.

alloc::vector<alloc::list<InVarPhis*>::type >::type cacao::jit::compiler2::SSAConstructionPass::incomplete_in_phi
private

Definition at line 62 of file SSAConstructionPass.hpp.

alloc::vector<alloc::vector<PHIInst*>::type >::type cacao::jit::compiler2::SSAConstructionPass::incomplete_phi
private

Definition at line 60 of file SSAConstructionPass.hpp.

jitdata* cacao::jit::compiler2::SSAConstructionPass::jd
private

Definition at line 55 of file SSAConstructionPass.hpp.

Method* cacao::jit::compiler2::SSAConstructionPass::M
private

Definition at line 54 of file SSAConstructionPass.hpp.

alloc::vector<bool>::type cacao::jit::compiler2::SSAConstructionPass::sealed_blocks
private

Definition at line 64 of file SSAConstructionPass.hpp.

alloc::vector<bool>::type cacao::jit::compiler2::SSAConstructionPass::skipped_blocks
private

Indicates whether IR construction should be skipped for a basicblock.

This vector is indexed by basicblock indices (i.e. by basicblock::nr).

See Also
SSAConstructionPass::deoptimize()

Definition at line 77 of file SSAConstructionPass.hpp.

alloc::vector<Type::TypeID>::type cacao::jit::compiler2::SSAConstructionPass::var_type_tbl
private

Definition at line 79 of file SSAConstructionPass.hpp.

alloc::vector<bool>::type cacao::jit::compiler2::SSAConstructionPass::visited_blocks
private

Used to remember which basicblocks have already been visited.

This vector is indexed by basicblock indices (i.e. by basicblock::nr).

Definition at line 70 of file SSAConstructionPass.hpp.


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