#include "jit-ir.h"
Public Types | |
typedef instruction_list::const_iterator | const_iterator |
typedef df_set::const_iterator | df_iterator |
typedef std::set< jit_block * > | df_set |
typedef std::list< jit_instruction * > | instruction_list |
typedef instruction_list::iterator | iterator |
Public Member Functions | |
jit_block (const std::string &aname, size_t avisit_count=0) | |
virtual void | accept (jit_ir_walker &walker) |
bool | alive (void) const |
template<typename T > | |
T * | append (T *instr) |
jit_instruction * | back (void) |
iterator | begin (void) |
const_iterator | begin (void) const |
bool | branch_alive (jit_block *asucc) const |
void | compute_df (void) |
void | compute_idom (jit_block &entry_block) |
void | create_dom_tree (void) |
const df_set & | df (void) const |
df_iterator | df_begin (void) const |
df_iterator | df_end (void) const |
jit_block * | dom_successor (size_t idx) const |
size_t | dom_successor_count (void) const |
iterator | end (void) |
const_iterator | end (void) const |
jit_use * | first_use (void) const |
jit_block * | first_use_block (void) |
jit_instruction * | front (void) |
bool | has_llvm (void) const |
size_t | id (void) const |
bool | in_worklist (void) const |
jit_instruction * | insert_after (iterator loc, jit_instruction *instr) |
jit_instruction * | insert_after (jit_instruction *loc, jit_instruction *instr) |
jit_instruction * | insert_before (iterator loc, jit_instruction *instr) |
jit_instruction * | insert_before (jit_instruction *loc, jit_instruction *instr) |
void | label (size_t avisit_count, size_t &number) |
void | label (void) |
jit_instruction * | last_use (void) const |
std::list< jit_block * >::iterator | location (void) const |
void | mark_alive (void) |
jit_block * | maybe_merge () |
jit_block * | maybe_split (jit_factory &factory, jit_block_list &blocks, jit_block &asuccessor) |
jit_block * | maybe_split (jit_factory &factory, jit_block_list &blocks, jit_block *asuccessor) |
void | merge (jit_block &merge) |
const std::string & | name (void) const |
virtual bool | needs_release (void) const |
iterator | nonphi_begin (void) |
iterator | phi_begin (void) |
iterator | phi_end (void) |
void | pop_all (void) |
jit_instruction * | prepend (jit_instruction *instr) |
jit_instruction * | prepend_after_phi (jit_instruction *instr) |
virtual std::ostream & | print (std::ostream &os, size_t indent=0) const |
std::ostream & | print_dom (std::ostream &os) const |
std::string | print_string (void) |
iterator | remove (iterator iter) |
void | replace_in_phi (jit_block *ablock, jit_block *with) |
virtual void | replace_with (jit_value *value) |
virtual std::ostream & | short_print (std::ostream &os) const |
void | stash_in_worklist (bool ain_worklist) |
void | stash_last_use (jit_instruction *alast_use) |
void | stash_llvm (llvm::Value *compiled) |
void | stash_location (std::list< jit_block * >::iterator alocation) |
void | stash_type (jit_type *new_type) |
jit_block * | successor (size_t i) const |
size_t | successor_count (void) const |
jit_terminator * | terminator (void) const |
llvm::BasicBlock * | to_llvm (void) const |
jit_type * | type (void) const |
llvm::Type * | type_llvm (void) const |
const std::string & | type_name (void) const |
size_t | use_count (void) const |
size_t | visit_count (void) const |
bool | visited (size_t avisit_count) |
Static Public Attributes | |
static const size_t | NO_ID = static_cast<size_t> (-1) |
Protected Member Functions | |
std::ostream & | print_indent (std::ostream &os, size_t indent=0) const |
Protected Attributes | |
llvm::Value * | m_llvm_value |
Private Types | |
typedef jit_internal_list< jit_block, jit_phi_incoming > | ILIST_T |
Private Member Functions | |
void | compute_df (size_t avisit_count) |
void | create_dom_tree (size_t avisit_count) |
void | internal_append (jit_instruction *instr) |
bool | update_idom (size_t avisit_count) |
Static Private Member Functions | |
static jit_block * | idom_intersect (jit_block *i, jit_block *j) |
Private Attributes | |
bool | m_alive |
df_set | m_df |
std::vector< jit_block * > | m_dom_succ |
size_t | m_id |
jit_block * | m_idom |
bool | m_in_worklist |
instruction_list | m_instructions |
jit_instruction * | m_last_use |
std::list< jit_block * >::iterator | m_location |
std::string | m_name |
jit_type * | m_type |
size_t | m_use_count |
jit_use * | m_use_head |
jit_use * | m_use_tail |
size_t | m_visit_count |
typedef instruction_list::const_iterator octave::jit_block::const_iterator |
typedef df_set::const_iterator octave::jit_block::df_iterator |
typedef std::set<jit_block *> octave::jit_block::df_set |
|
private |
typedef std::list<jit_instruction *> octave::jit_block::instruction_list |
typedef instruction_list::iterator octave::jit_block::iterator |
|
inline |
|
virtual |
Implements octave::jit_value.
|
inline |
Definition at line 591 of file jit-ir.h.
Referenced by octave::jit_phi::infer(), maybe_split(), and octave::jit_infer::remove_dead().
|
inline |
Definition at line 608 of file jit-ir.h.
Referenced by octave::jit_convert::jit_convert(), octave::jit_convert::create_checked_impl(), octave::jit_convert::do_assign(), octave::jit_convert::finish_breaks(), maybe_split(), prepend_after_phi(), octave::jit_infer::remove_dead(), octave::jit_convert::visit_boolean_expression(), octave::jit_convert::visit_colon_expression(), octave::jit_convert::visit_do_until_command(), octave::jit_convert::visit_identifier(), octave::jit_convert::visit_if_command_list(), octave::jit_convert::visit_simple_for_command(), octave::jit_convert::visit_statement(), octave::jit_convert::visit_switch_command(), and octave::jit_convert::visit_while_command().
|
inline |
Definition at line 764 of file jit-ir.h.
Referenced by octave::jit_block_list::back(), and octave::jit_convert_llvm::convert_function().
|
inline |
Definition at line 645 of file jit-ir.h.
Referenced by octave::jit_infer::append_users_term(), octave::jit_convert_llvm::convert(), octave::jit_convert_llvm::convert_loop(), octave::jit_infer::do_construct_ssa(), merge(), pop_all(), prepend_after_phi(), print(), octave::jit_infer::release_dead_phi(), octave::jit_infer::release_temp(), octave::jit_infer::remove_dead(), octave::jit_infer::simplify_phi(), and octave::jit_convert_llvm::visit().
|
inline |
bool octave::jit_block::branch_alive | ( | jit_block * | asucc | ) | const |
Definition at line 374 of file jit-ir.cc.
References octave::jit_terminator::alive(), and terminator().
Referenced by octave::jit_phi::infer(), and octave::jit_phi::prune().
|
private |
Definition at line 434 of file jit-ir.cc.
References compute_df(), first_use(), m_df, m_idom, octave::jit_internal_node< LIST_T, NODE_T >::next(), successor(), successor_count(), use_count(), and visited().
|
inline |
Definition at line 691 of file jit-ir.h.
Referenced by compute_df(), and octave::jit_infer::construct_ssa().
|
inline |
Definition at line 681 of file jit-ir.h.
References m_idom.
Referenced by octave::jit_infer::construct_ssa().
|
private |
Definition at line 567 of file jit-ir.cc.
References create_dom_tree(), m_dom_succ, m_idom, successor(), successor_count(), and visited().
|
inline |
Definition at line 696 of file jit-ir.h.
Referenced by octave::jit_infer::construct_ssa(), and create_dom_tree().
|
inline |
Definition at line 665 of file jit-ir.h.
Referenced by octave::jit_infer::construct_ssa(), and print_dom().
|
inline |
Definition at line 667 of file jit-ir.h.
Referenced by octave::jit_infer::construct_ssa(), and print_dom().
|
inline |
Definition at line 701 of file jit-ir.h.
Referenced by octave::jit_infer::do_construct_ssa().
|
inline |
Definition at line 706 of file jit-ir.h.
Referenced by octave::jit_infer::do_construct_ssa().
|
inline |
Definition at line 649 of file jit-ir.h.
Referenced by octave::jit_infer::append_users_term(), octave::jit_convert_llvm::convert(), octave::jit_convert_llvm::convert_loop(), octave::jit_infer::do_construct_ssa(), merge(), pop_all(), prepend_after_phi(), print(), octave::jit_infer::release_dead_phi(), octave::jit_infer::release_temp(), octave::jit_infer::remove_dead(), octave::jit_infer::simplify_phi(), and octave::jit_convert_llvm::visit().
|
inline |
|
inline |
Definition at line 586 of file jit-ir.h.
References octave::jit_internal_list< jit_value, jit_use >::first_use().
Referenced by compute_df(), label(), print(), print_dom(), and update_idom().
|
inherited |
Definition at line 156 of file jit-ir.cc.
References octave::jit_internal_list< jit_value, jit_use >::first_use(), octave::jit_internal_node< LIST_T, NODE_T >::next(), octave::jit_use::user(), and octave::jit_use::user_parent().
Referenced by octave::jit_infer::release_temp().
|
inline |
Definition at line 762 of file jit-ir.h.
Referenced by octave::jit_infer::construct_ssa(), and octave::jit_block_list::front().
|
inlineinherited |
|
inline |
Definition at line 660 of file jit-ir.h.
Referenced by idom_intersect(), and octave::jit_infer::place_releases().
|
inlineinherited |
Definition at line 194 of file jit-ir.h.
Referenced by octave::jit_infer::push_worklist().
jit_instruction * octave::jit_block::insert_after | ( | iterator | loc, |
jit_instruction * | instr | ||
) |
Definition at line 355 of file jit-ir.cc.
References loc, m_instructions, and octave::jit_instruction::stash_parent().
Referenced by octave::jit_infer::release_temp().
|
inline |
jit_instruction * octave::jit_block::insert_before | ( | iterator | loc, |
jit_instruction * | instr | ||
) |
Definition at line 347 of file jit-ir.cc.
References loc, m_instructions, and octave::jit_instruction::stash_parent().
Referenced by prepend_after_phi(), octave::jit_infer::release_dead_phi(), octave::jit_infer::release_temp(), and octave::jit_infer::simplify_phi().
|
inline |
|
private |
Definition at line 340 of file jit-ir.cc.
References m_instructions, and octave::jit_instruction::stash_parent().
void octave::jit_block::label | ( | size_t | avisit_count, |
size_t & | number | ||
) |
Definition at line 491 of file jit-ir.cc.
References first_use(), label(), m_id, octave::jit_internal_node< LIST_T, NODE_T >::next(), and visited().
|
inline |
Definition at line 670 of file jit-ir.h.
Referenced by label(), and octave::jit_block_list::label().
|
inlineinherited |
|
inline |
Definition at line 593 of file jit-ir.h.
Referenced by octave::jit_terminator::infer(), octave::jit_convert::initialize(), and maybe_split().
jit_block * octave::jit_block::maybe_merge | ( | void | ) |
Definition at line 271 of file jit-ir.cc.
References m_instructions, merge(), successor(), successor_count(), and use_count().
|
inline |
jit_block * octave::jit_block::maybe_split | ( | jit_factory & | factory, |
jit_block_list & | blocks, | ||
jit_block * | asuccessor | ||
) |
Definition at line 538 of file jit-ir.cc.
References alive(), append(), octave::jit_factory::create(), octave::jit_terminator::infer(), octave::jit_block_list::insert_after(), m_visit_count, mark_alive(), replace_in_phi(), octave::jit_instruction::stash_argument(), successor_count(), octave::jit_terminator::successor_index(), and terminator().
Referenced by octave::jit_infer::release_dead_phi(), octave::jit_infer::release_temp(), and octave::jit_infer::simplify_phi().
void octave::jit_block::merge | ( | jit_block & | merge | ) |
Definition at line 285 of file jit-ir.cc.
References begin(), end(), m_instructions, octave::jit_instruction::remove(), replace_with(), octave::jit_instruction::stash_parent(), and terminator().
Referenced by maybe_merge().
|
inline |
Definition at line 601 of file jit-ir.h.
Referenced by octave::jit_convert_llvm::convert(), octave::jit_convert::create_checked_impl(), and octave::jit_convert::visit_boolean_expression().
|
inlinevirtualinherited |
Reimplemented in octave::jit_call.
Definition at line 239 of file jit-ir.h.
Referenced by octave::jit_infer::release_dead_phi(), and octave::jit_infer::release_temp().
iterator octave::jit_block::nonphi_begin | ( | void | ) |
iterator octave::jit_block::phi_begin | ( | void | ) |
iterator octave::jit_block::phi_end | ( | void | ) |
void octave::jit_block::pop_all | ( | void | ) |
Definition at line 506 of file jit-ir.cc.
References begin(), end(), and octave::jit_instruction::pop_variable().
Referenced by octave::jit_infer::do_construct_ssa().
jit_instruction * octave::jit_block::prepend | ( | jit_instruction * | instr | ) |
Definition at line 315 of file jit-ir.cc.
References m_instructions, and octave::jit_instruction::stash_parent().
Referenced by octave::jit_infer::construct_ssa(), and octave::jit_convert::create_variable().
jit_instruction * octave::jit_block::prepend_after_phi | ( | jit_instruction * | instr | ) |
|
virtual |
Implements octave::jit_value.
Definition at line 516 of file jit-ir.cc.
References begin(), end(), first_use(), octave::jit_internal_node< LIST_T, NODE_T >::next(), octave::jit_value::print(), octave::jit_value::print_indent(), and short_print().
std::ostream & octave::jit_block::print_dom | ( | std::ostream & | os | ) | const |
Definition at line 400 of file jit-ir.cc.
References df_begin(), df_end(), first_use(), m_dom_succ, m_id, m_idom, octave::jit_internal_node< LIST_T, NODE_T >::next(), short_print(), successor(), and successor_count().
|
inlineprotectedinherited |
Definition at line 266 of file jit-ir.h.
Referenced by print(), octave::jit_error_check::print(), and octave::jit_magic_end::print().
|
inlineinherited |
Definition at line 628 of file jit-ir.h.
References octave::jit_instruction::stash_parent().
Referenced by octave::jit_instruction::remove(), and octave::jit_infer::remove_dead().
Definition at line 257 of file jit-ir.cc.
References octave::jit_internal_list< jit_block, jit_phi_incoming >::first_use(), octave::jit_internal_node< LIST_T, NODE_T >::next(), octave::jit_internal_node< LIST_T, NODE_T >::stash_value(), and octave::jit_phi_incoming::user_parent().
Referenced by maybe_split().
|
virtual |
Reimplemented from octave::jit_value.
Definition at line 242 of file jit-ir.cc.
References octave::jit_internal_list< jit_block, jit_phi_incoming >::first_use(), octave::jit_value::replace_with(), and octave::jit_internal_node< LIST_T, NODE_T >::stash_value().
Referenced by merge().
|
inlinevirtual |
Reimplemented from octave::jit_value.
Definition at line 728 of file jit-ir.h.
Referenced by print(), and print_dom().
|
inlineinherited |
Definition at line 199 of file jit-ir.h.
Referenced by octave::jit_infer::push_worklist().
|
inlineinherited |
|
inlineinherited |
Definition at line 259 of file jit-ir.h.
Referenced by octave::jit_convert_llvm::convert(), and octave::jit_convert_llvm::visit().
Definition at line 743 of file jit-ir.h.
Referenced by octave::jit_block_list::insert_before(), and octave::jit_block_list::push_back().
|
inlineinherited |
Definition at line 223 of file jit-ir.h.
Referenced by octave::jit_phi::infer(), octave::jit_call::infer(), and octave::jit_magic_end::infer().
jit_block * octave::jit_block::successor | ( | size_t | i | ) | const |
Definition at line 380 of file jit-ir.cc.
References octave::jit_terminator::successor(), and terminator().
Referenced by compute_df(), create_dom_tree(), octave::jit_infer::do_construct_ssa(), maybe_merge(), and print_dom().
size_t octave::jit_block::successor_count | ( | void | ) | const |
Definition at line 387 of file jit-ir.cc.
References octave::jit_terminator::successor_count(), and terminator().
Referenced by compute_df(), create_dom_tree(), octave::jit_infer::do_construct_ssa(), maybe_merge(), maybe_split(), and print_dom().
jit_terminator * octave::jit_block::terminator | ( | void | ) | const |
Definition at line 364 of file jit-ir.cc.
References m_instructions.
Referenced by octave::jit_infer::append_users_term(), branch_alive(), maybe_split(), merge(), octave::jit_infer::release_dead_phi(), octave::jit_infer::release_temp(), octave::jit_infer::remove_dead(), octave::jit_infer::simplify_phi(), successor(), and successor_count().
llvm::BasicBlock * octave::jit_block::to_llvm | ( | void | ) | const |
Definition at line 394 of file jit-ir.cc.
References octave::jit_value::m_llvm_value.
Referenced by octave::jit_convert_llvm::convert(), octave::jit_instruction::parent_llvm(), and octave::jit_convert_llvm::visit().
|
inlineinherited |
Definition at line 211 of file jit-ir.h.
Referenced by octave::jit_typeinfo::do_end(), octave::jit_phi::infer(), octave::jit_call::infer(), octave::jit_magic_end::infer(), octave::jit_call::needs_release(), octave::jit_return::result_type(), octave::jit_instruction::short_print(), octave::jit_infer::simplify_phi(), octave::jit_factory::track_value(), and octave::jit_convert_llvm::visit().
|
inlineinherited |
Definition at line 213 of file jit-ir.h.
Referenced by octave::jit_convert_llvm::visit().
|
inlineinherited |
|
private |
Definition at line 457 of file jit-ir.cc.
References first_use(), idom_intersect(), m_idom, octave::jit_internal_node< LIST_T, NODE_T >::next(), update_idom(), use_count(), octave::jit_use::user_parent(), and visited().
Referenced by update_idom().
|
inline |
Definition at line 588 of file jit-ir.h.
References octave::jit_internal_list< jit_value, jit_use >::use_count().
Referenced by compute_df(), octave::jit_infer::construct_ssa(), maybe_merge(), and update_idom().
|
inline |
|
inline |
Definition at line 751 of file jit-ir.h.
Referenced by compute_df(), create_dom_tree(), octave::jit_infer::do_construct_ssa(), label(), and update_idom().
|
private |
Definition at line 783 of file jit-ir.h.
Referenced by compute_df().
|
private |
Definition at line 784 of file jit-ir.h.
Referenced by create_dom_tree(), and print_dom().
|
private |
Definition at line 781 of file jit-ir.h.
Referenced by label(), and print_dom().
|
private |
Definition at line 782 of file jit-ir.h.
Referenced by compute_df(), compute_idom(), create_dom_tree(), idom_intersect(), print_dom(), and update_idom().
|
private |
Definition at line 786 of file jit-ir.h.
Referenced by insert_after(), insert_before(), internal_append(), maybe_merge(), merge(), prepend(), and terminator().
|
privateinherited |
|
protectedinherited |
|
privateinherited |
Definition at line 153 of file jit-util.h.
|
privateinherited |
Definition at line 151 of file jit-util.h.
|
privateinherited |
Definition at line 152 of file jit-util.h.
|
private |
Definition at line 780 of file jit-ir.h.
Referenced by maybe_split().
|
static |
Definition at line 574 of file jit-ir.h.
Referenced by octave::jit_infer::place_releases().