26 #define __STDC_LIMIT_MACROS 27 #define __STDC_CONSTANT_MACROS 29 #if defined (HAVE_CONFIG_H) 33 #if defined (HAVE_LLVM) 37 #if defined (HAVE_LLVM_IR_FUNCTION_H) 38 # include <llvm/IR/BasicBlock.h> 39 # include <llvm/IR/Instructions.h> 41 # include <llvm/BasicBlock.h> 42 # include <llvm/Instructions.h> 83 iter =
m_list.insert (iter, ablock);
106 os <<
"-------------------- " << header <<
" --------------------\n";
113 os <<
"-------------------- dom info --------------------\n";
117 (*iter)->print_dom (
os);
129 b->stash_location (--iter);
136 iter != blocks.
end (); ++iter)
139 (*iter)->print (
os, 0);
141 return os << std::endl;
161 if (! isa<jit_error_check> (use->
user ()))
181 #define JIT_METH(clname) \ 183 jit_ ## clname::accept (jit_ir_walker& walker) \ 185 walker.visit (*this); \ 231 for (
size_t i =
start;
i < end; ++
i)
235 if (
var &&
var->has_top ())
244 assert (isa<jit_block> (
value));
263 node = node->
next ();
292 bool was_empty =
end () ==
begin ();
299 merge_begin =
begin ();
305 for (
iterator iter = merge_begin; iter !=
end (); ++iter)
329 if (! isa<jit_phi> (temp))
404 os <<
" m_id: " <<
m_id << std::endl;
405 os <<
" predecessors: ";
407 os << *use->user_parent () <<
' ';
410 os <<
" successors: ";
426 os <<
" m_dom_succ: ";
430 return os << std::endl;
446 runner->
m_df.insert (
this);
462 bool changed =
false;
466 changed = pred->
update_idom (avisit_count) || changed;
473 for (; use; use = use->
next ())
532 instr->
print (
os, indent + 1) << std::endl;
582 while (
i && j &&
i != j)
584 while (
i &&
i->id () > j->
id ())
657 if (infered !=
type ())
677 for (
size_t i = 0;
i < scount; ++
i)
690 bool changed =
false;
702 llvm::TerminatorInst *
740 std::stringstream ss;
741 ss <<
"Missing overload in type inference for ";
746 if (infered !=
type ())
762 return "error_state";
784 size_t aindex,
size_t acount)
785 : m_value (avalue), m_index (factory.create<
jit_const_index> (aindex)),
795 std::vector<context>::const_iterator iter;
804 for (idx = 0; idx <
m_contexts.size (); ++idx)
823 if (new_type !=
type ())
jit_type * result(const signature_vec &types) const
void stash_value(LIST_T *avalue)
void insert_after(iterator iter, jit_block *ablock)
llvm::BasicBlock * parent_llvm(void) const
while(ischar(s=fgets(fid))) fputs(stdout
void create_dom_tree(void)
jit_instruction * prepend(jit_instruction *instr)
instruction_list::iterator iterator
std::vector< jit_phi_incoming > m_incoming
virtual bool needs_release(void) const
jit_instruction * prepend_after_phi(jit_instruction *instr)
void stash_argument(size_t i, jit_value *arg)
size_t successor_index(const jit_block *asuccessor) const
std::list< jit_block * > m_list
jit_use * first_use(void) const
std::ostream & print_dom(std::ostream &os) const
virtual std::ostream & print(std::ostream &os, size_t indent=0) const =0
void resize_arguments(size_t acount, jit_value *adefault=nullptr)
bool has_check_for(void) const
void merge(jit_block &merge)
bool artificial(void) const
bool alive(const jit_block *asuccessor) const
jit_block * first_use_block(void)
void do_construct_ssa(size_t start, size_t end)
virtual std::ostream & short_print(std::ostream &os) const
df_set::const_iterator df_iterator
for fields that display a single number
void push_back(jit_block *b)
jit_block * parent(void) const
std::vector< context > m_contexts
jit_type * jit_type_join(jit_type *lhs, jit_type *rhs)
#define JIT_VISIT_IR_NOTEMPLATE
jit_terminator * terminator(void) const
void replace_in_phi(jit_block *ablock, jit_block *with)
T * create(const Args &... args)
df_iterator df_begin(void) const
size_t argument_count(void) const
llvm::BasicBlock * to_llvm(void) const
llvm::Value * m_llvm_value
jit_block * maybe_merge()
void stash_parent(jit_block *aparent, std::list< jit_instruction *>::iterator alocation)
std::ostream & jit_print(std::ostream &os, jit_value *avalue)
jit_block * successor(size_t i) const
std::ostream & print_indent(std::ostream &os, size_t indent=0) const
virtual std::ostream & print(std::ostream &os, size_t indent=0) const
NODE_T * next(void) const
std::list< jit_block * >::const_iterator const_iterator
virtual std::ostream & print(std::ostream &os, size_t indent=0) const
bool visited(size_t avisit_count)
jit_type * argument_type(size_t i) const
virtual void replace_with(jit_value *m_value)
jit_block * user_parent(void) const
virtual void pop_variable(void)
virtual std::ostream & short_print(std::ostream &os) const
std::ostream & operator<<(std::ostream &os, const jit_block_list &blocks)
void stash_type(jit_type *new_type)
jit_call * check_for(void) const
std::ostream & print_dom(std::ostream &os) const
size_t successor_count(void) const
size_t use_count(void) const
jit_value * argument(size_t i) const
jit_const_index * m_index
void internal_append(jit_instruction *instr)
iterator remove(iterator iter)
context resolve_context(void) const
df_iterator df_end(void) const
jit_block * successor(size_t idx=0) const
jit_type * type(void) const
std::list< jit_instruction * >::iterator m_location
jit_use * first_use(void) const
std::vector< jit_type * > m_already_infered
virtual void replace_with(jit_value *value)
#define panic_impossible()
std::list< jit_block * >::iterator iterator
instruction_list m_instructions
static jit_block * idom_intersect(jit_block *i, jit_block *j)
void track_value(jit_value *v)
virtual std::ostream & print(std::ostream &os, size_t indent=0) const
instruction_list::const_iterator const_iterator
static const jit_function & get_release(jit_type *type)
static const jit_operation & end(void)
jit_instruction * insert_after(iterator loc, jit_instruction *instr)
std::ostream & print_successor(std::ostream &os, size_t idx=0) const
static std::string variable_to_string(variable v)
jit_type * result(void) const
jit_block * user_parent(void) const
const jit_operation & m_operation
virtual std::ostream & print(std::ostream &os, size_t indent=0) const
bool branch_alive(jit_block *asucc) const
llvm::Value * to_llvm(void) const
jit_instruction * insert_before(iterator loc, jit_instruction *instr)
std::vector< jit_block * > m_dom_succ
bool skip_paren(void) const
const jit_function & overload() const
size_t successor_count(void) const
llvm::PHINode * to_llvm(void) const
jit_block * incoming(size_t i) const
jit_block * maybe_split(jit_factory &factory, jit_block_list &blocks, jit_block *asuccessor)
void insert_before(iterator iter, jit_block *ablock)
jit_instruction * user(void) const
std::vector< bool > m_alive
size_t use_count(void) const
std::ostream & print(std::ostream &os, const std::string &header) const
bool update_idom(size_t avisit_count)
virtual std::ostream & short_print(std::ostream &os) const
jit_const_index * m_count
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
nd group nd example For each display the value
llvm::TerminatorInst * to_llvm(void) const
jit_magic_end(const std::vector< context > &full_context)
virtual bool check_alive(size_t) const
void stash_location(std::list< jit_block *>::iterator alocation)