GNU Octave
4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#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 (void) |
void | label (size_t avisit_count, size_t &number) |
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_ty) |
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 * | llvm_value |
Private Types | |
typedef jit_internal_list < jit_block, jit_phi_incomming > | 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 | |
std::vector< jit_block * > | dom_succ |
jit_block * | idom |
instruction_list | instructions |
bool | malive |
df_set | mdf |
size_t | mid |
std::list< jit_block * >::iterator | mlocation |
std::string | mname |
size_t | mvisit_count |
typedef instruction_list::const_iterator jit_block::const_iterator |
typedef df_set::const_iterator jit_block::df_iterator |
typedef std::set<jit_block *> jit_block::df_set |
|
private |
typedef std::list<jit_instruction *> jit_block::instruction_list |
typedef instruction_list::iterator jit_block::iterator |
|
inline |
|
virtual |
|
inline |
Definition at line 565 of file jit-ir.h.
Referenced by jit_phi::infer(), maybe_split(), and jit_infer::remove_dead().
|
inline |
Definition at line 582 of file jit-ir.h.
Referenced by jit_convert::create_checked_impl(), jit_convert::do_assign(), jit_convert::finish_breaks(), jit_convert::jit_convert(), maybe_split(), prepend_after_phi(), jit_infer::remove_dead(), jit_convert::visit_binary_expression(), jit_convert::visit_colon_expression(), jit_convert::visit_do_until_command(), jit_convert::visit_identifier(), jit_convert::visit_if_command_list(), jit_convert::visit_simple_for_command(), jit_convert::visit_statement(), jit_convert::visit_switch_command(), and jit_convert::visit_while_command().
|
inline |
Definition at line 738 of file jit-ir.h.
Referenced by jit_block_list::begin(), and jit_convert_llvm::convert_function().
|
inline |
Definition at line 619 of file jit-ir.h.
Referenced by jit_infer::append_users_term(), jit_convert_llvm::convert(), jit_convert_llvm::convert_loop(), jit_infer::do_construct_ssa(), merge(), pop_all(), prepend_after_phi(), print(), jit_infer::release_dead_phi(), jit_infer::release_temp(), jit_infer::remove_dead(), jit_infer::simplify_phi(), and jit_convert_llvm::visit().
|
inline |
Definition at line 372 of file jit-ir.cc.
References jit_terminator::alive(), and terminator().
Referenced by jit_phi::infer(), and jit_phi::prune().
|
inline |
Definition at line 665 of file jit-ir.h.
References idom.
Referenced by compute_df(), and jit_infer::construct_ssa().
|
private |
Definition at line 432 of file jit-ir.cc.
References compute_df(), first_use(), idom, mdf, jit_internal_node< LIST_T, NODE_T >::next(), successor(), successor_count(), use_count(), and visited().
|
inline |
Definition at line 655 of file jit-ir.h.
Referenced by jit_infer::construct_ssa().
|
inline |
Definition at line 670 of file jit-ir.h.
Referenced by jit_infer::construct_ssa(), and create_dom_tree().
|
private |
Definition at line 565 of file jit-ir.cc.
References create_dom_tree(), dom_succ, idom, successor(), successor_count(), and visited().
|
inline |
Definition at line 639 of file jit-ir.h.
Referenced by jit_infer::construct_ssa(), and print_dom().
|
inline |
Definition at line 641 of file jit-ir.h.
Referenced by jit_infer::construct_ssa(), and print_dom().
Definition at line 675 of file jit-ir.h.
Referenced by jit_infer::do_construct_ssa().
|
inline |
Definition at line 680 of file jit-ir.h.
Referenced by jit_infer::do_construct_ssa().
|
inline |
Definition at line 623 of file jit-ir.h.
Referenced by jit_infer::append_users_term(), jit_convert_llvm::convert(), jit_convert_llvm::convert_loop(), jit_infer::do_construct_ssa(), merge(), pop_all(), prepend_after_phi(), print(), jit_infer::release_dead_phi(), jit_infer::release_temp(), jit_infer::remove_dead(), jit_infer::simplify_phi(), and jit_convert_llvm::visit().
|
inline |
|
inline |
Definition at line 560 of file jit-ir.h.
Referenced by compute_df(), label(), print(), print_dom(), and update_idom().
|
inherited |
Definition at line 153 of file jit-ir.cc.
References jit_internal_list< jit_value, jit_use >::first_use(), jit_internal_node< LIST_T, NODE_T >::next(), jit_use::user(), and jit_use::user_parent().
Referenced by jit_infer::release_temp().
|
inline |
|
inlineinherited |
Definition at line 245 of file jit-ir.h.
References jit_value::print().
|
inline |
Definition at line 634 of file jit-ir.h.
Referenced by idom_intersect(), and jit_infer::place_releases().
|
inlineinherited |
Definition at line 191 of file jit-ir.h.
Referenced by jit_infer::push_worklist().
jit_instruction * jit_block::insert_after | ( | iterator | loc, |
jit_instruction * | instr | ||
) |
Definition at line 352 of file jit-ir.cc.
References instructions, loc, and jit_instruction::stash_parent().
Referenced by jit_infer::release_temp().
|
inline |
jit_instruction * jit_block::insert_before | ( | iterator | loc, |
jit_instruction * | instr | ||
) |
Definition at line 344 of file jit-ir.cc.
References instructions, and jit_instruction::stash_parent().
Referenced by prepend_after_phi(), jit_infer::release_dead_phi(), jit_infer::release_temp(), and jit_infer::simplify_phi().
|
inline |
|
private |
Definition at line 337 of file jit-ir.cc.
References instructions, and jit_instruction::stash_parent().
|
inline |
Definition at line 644 of file jit-ir.h.
References jit_instruction::mid.
Referenced by jit_block_list::label(), and label().
Definition at line 489 of file jit-ir.cc.
References first_use(), label(), mid, jit_internal_node< LIST_T, NODE_T >::next(), and visited().
|
inlineinherited |
Definition at line 714 of file jit-ir.h.
Referenced by jit_block_list::insert_after(), and jit_block_list::insert_before().
|
inline |
Definition at line 567 of file jit-ir.h.
Referenced by jit_terminator::infer(), jit_convert::initialize(), and maybe_split().
jit_block * jit_block::maybe_merge | ( | ) |
Definition at line 268 of file jit-ir.cc.
References instructions, merge(), successor(), successor_count(), and use_count().
jit_block * jit_block::maybe_split | ( | jit_factory & | factory, |
jit_block_list & | blocks, | ||
jit_block * | asuccessor | ||
) |
Definition at line 536 of file jit-ir.cc.
References alive(), append(), jit_factory::create(), jit_terminator::infer(), jit_block_list::insert_after(), mark_alive(), mvisit_count, replace_in_phi(), jit_instruction::stash_argument(), successor_count(), jit_terminator::successor_index(), and terminator().
Referenced by jit_infer::release_dead_phi(), jit_infer::release_temp(), and jit_infer::simplify_phi().
|
inline |
void jit_block::merge | ( | jit_block & | merge | ) |
Definition at line 282 of file jit-ir.cc.
References begin(), end(), instructions, jit_instruction::remove(), replace_with(), jit_instruction::stash_parent(), and terminator().
Referenced by maybe_merge().
|
inline |
Definition at line 575 of file jit-ir.h.
References jit_terminator::malive.
Referenced by jit_convert_llvm::convert(), jit_convert::create_checked_impl(), and jit_convert::visit_binary_expression().
|
inlinevirtualinherited |
Reimplemented in jit_call.
Definition at line 236 of file jit-ir.h.
References jit_value::mlast_use.
Referenced by jit_infer::release_dead_phi(), and jit_infer::release_temp().
iterator jit_block::nonphi_begin | ( | void | ) |
iterator jit_block::phi_begin | ( | void | ) |
iterator jit_block::phi_end | ( | void | ) |
void jit_block::pop_all | ( | void | ) |
Definition at line 504 of file jit-ir.cc.
References begin(), end(), and jit_instruction::pop_variable().
Referenced by jit_infer::do_construct_ssa().
jit_instruction * jit_block::prepend | ( | jit_instruction * | instr | ) |
Definition at line 312 of file jit-ir.cc.
References instructions, and jit_instruction::stash_parent().
Referenced by jit_infer::construct_ssa(), and jit_convert::create_variable().
jit_instruction * jit_block::prepend_after_phi | ( | jit_instruction * | instr | ) |
|
virtual |
Implements jit_value.
Definition at line 514 of file jit-ir.cc.
References begin(), end(), first_use(), jit_internal_node< LIST_T, NODE_T >::next(), jit_value::print(), jit_value::print_indent(), and short_print().
std::ostream & jit_block::print_dom | ( | std::ostream & | os | ) | const |
Definition at line 398 of file jit-ir.cc.
References df_begin(), df_end(), dom_succ, first_use(), idom, mid, jit_internal_node< LIST_T, NODE_T >::next(), short_print(), successor(), and successor_count().
|
inlineprotectedinherited |
Definition at line 262 of file jit-ir.h.
References jit_value::llvm_value.
Referenced by jit_call::jit_call(), jit_store_argument::name(), jit_argument::print(), print(), jit_error_check::print(), and jit_magic_end::print().
|
inlineinherited |
Definition at line 602 of file jit-ir.h.
Referenced by jit_instruction::remove(), and jit_infer::remove_dead().
Definition at line 254 of file jit-ir.cc.
References jit_internal_list< jit_block, jit_phi_incomming >::first_use(), jit_internal_node< LIST_T, NODE_T >::next(), jit_internal_node< LIST_T, NODE_T >::stash_value(), and jit_phi_incomming::user_parent().
Referenced by maybe_split().
|
virtual |
Reimplemented from jit_value.
Definition at line 239 of file jit-ir.cc.
References jit_internal_list< jit_block, jit_phi_incomming >::first_use(), jit_value::replace_with(), and jit_internal_node< LIST_T, NODE_T >::stash_value().
Referenced by merge().
|
inlinevirtual |
Reimplemented from jit_value.
Definition at line 702 of file jit-ir.h.
Referenced by print(), and print_dom().
|
inlineinherited |
Definition at line 196 of file jit-ir.h.
References jit_value::min_worklist.
Referenced by jit_infer::infer(), and jit_infer::push_worklist().
|
inlineinherited |
|
inlineinherited |
Definition at line 256 of file jit-ir.h.
References jit_value::llvm_value.
Referenced by jit_convert_llvm::convert(), jit_argument::print(), and jit_convert_llvm::visit().
Definition at line 717 of file jit-ir.h.
Referenced by jit_block_list::insert_before(), and jit_block_list::push_back().
|
inlineinherited |
Definition at line 220 of file jit-ir.h.
Referenced by jit_phi::infer(), jit_call::infer(), jit_magic_end::infer(), jit_argument::print(), jit_const< T, EXTRACT_T, PASS_T, QUOTE >::print(), jit_assign::print(), and jit_extract_argument::print().
Definition at line 378 of file jit-ir.cc.
References jit_terminator::successor(), and terminator().
Referenced by compute_df(), create_dom_tree(), jit_infer::do_construct_ssa(), maybe_merge(), and print_dom().
size_t jit_block::successor_count | ( | void | ) | const |
Definition at line 385 of file jit-ir.cc.
References jit_terminator::successor_count(), and terminator().
Referenced by compute_df(), create_dom_tree(), jit_infer::do_construct_ssa(), maybe_merge(), maybe_split(), and print_dom().
jit_terminator * jit_block::terminator | ( | void | ) | const |
Definition at line 361 of file jit-ir.cc.
References instructions.
Referenced by jit_infer::append_users_term(), branch_alive(), jit_infer::infer(), maybe_split(), merge(), jit_infer::release_dead_phi(), jit_infer::release_temp(), jit_infer::remove_dead(), jit_infer::simplify_phi(), successor(), and successor_count().
llvm::BasicBlock * jit_block::to_llvm | ( | void | ) | const |
Definition at line 392 of file jit-ir.cc.
References jit_value::llvm_value.
Referenced by jit_convert_llvm::convert(), jit_instruction::parent_llvm(), and jit_convert_llvm::visit().
|
inlineinherited |
Definition at line 208 of file jit-ir.h.
Referenced by jit_typeinfo::do_end(), jit_phi::infer(), jit_call::infer(), jit_magic_end::infer(), jit_call::needs_release(), jit_instruction::print_argument(), jit_instruction::short_print(), jit_infer::simplify_phi(), jit_factory::track_value(), and jit_convert_llvm::visit().
|
inlineinherited |
Definition at line 210 of file jit-ir.h.
Referenced by jit_convert_llvm::visit().
|
inlineinherited |
Definition at line 215 of file jit-ir.h.
References jit_type::to_llvm(), and jit_value::ty.
Definition at line 455 of file jit-ir.cc.
References first_use(), idom, idom_intersect(), jit_internal_node< LIST_T, NODE_T >::next(), update_idom(), use_count(), jit_use::user_parent(), and visited().
Referenced by update_idom().
|
inline |
Definition at line 562 of file jit-ir.h.
Referenced by compute_df(), jit_infer::construct_ssa(), maybe_merge(), and update_idom().
Definition at line 725 of file jit-ir.h.
References jit_instruction::mlocation.
Referenced by compute_df(), create_dom_tree(), jit_infer::do_construct_ssa(), label(), and update_idom().
|
private |
Definition at line 756 of file jit-ir.h.
Referenced by create_dom_tree(), and print_dom().
|
private |
Definition at line 754 of file jit-ir.h.
Referenced by compute_df(), create_dom_tree(), idom_intersect(), print_dom(), and update_idom().
|
private |
Definition at line 758 of file jit-ir.h.
Referenced by insert_after(), insert_before(), internal_append(), maybe_merge(), merge(), prepend(), and terminator().
|
protectedinherited |
Definition at line 269 of file jit-ir.h.
Referenced by jit_value::print_indent(), jit_value::stash_llvm(), jit_value::to_llvm(), and to_llvm().
|
private |
Definition at line 755 of file jit-ir.h.
Referenced by compute_df().
|
private |
Definition at line 753 of file jit-ir.h.
Referenced by label(), and print_dom().
|
private |
Definition at line 752 of file jit-ir.h.
Referenced by maybe_split().
Definition at line 548 of file jit-ir.h.
Referenced by jit_infer::place_releases().