/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
}
/* Allocates a list of nodes:
- - The start block containing a start node and Proj nodes for it's four
+ - The start block containing a start node and Proj nodes for its four
results (X, M, P, Tuple).
- The end block containing an end node. This block is not matured after
new_ir_graph as predecessors need to be added to it.
{
ir_graph *res;
ir_node *first_block;
- ir_node *end, *start, *start_block, *initial_mem, *projX, *bad;
+ ir_node *start, *start_block, *initial_mem, *projX;
res = alloc_graph();
res->additional_properties = mtp_property_inherited; /* inherited from type */
res->irg_pinned_state = op_pin_state_pinned;
- res->outs_state = outs_none;
- res->dom_state = dom_none;
- res->pdom_state = dom_none;
res->typeinfo_state = ir_typeinfo_none;
set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
res->callee_info_state = irg_callee_info_none;
res->extblk_state = ir_extblk_info_none;
res->execfreq_state = exec_freq_none;
res->fp_model = fp_model_precise;
- res->entity_usage_state = ir_entity_usage_not_computed;
res->mem_disambig_opt = aa_opt_inherited;
/*-- Type information for the procedure of the graph --*/
/*-- Nodes needed in every graph --*/
set_irg_end_block (res, new_r_immBlock(res));
- end = new_r_End(res, 0, NULL);
- set_irg_end(res, end);
+ set_irg_end(res, new_r_End(res, 0, NULL));
start_block = new_r_Block_noopt(res, 0, NULL);
set_irg_start_block(res, start_block);
- bad = new_r_Bad(res);
- set_irg_bad (res, bad);
set_irg_no_mem (res, new_r_NoMem(res));
start = new_r_Start(res);
set_irg_start (res, start);
projX = new_r_Proj(start, mode_X, pn_Start_X_initial_exec);
set_irg_initial_exec (res, projX);
set_irg_frame (res, new_r_Proj(start, mode_P_data, pn_Start_P_frame_base));
- set_irg_tls (res, new_r_Proj(start, mode_P_data, pn_Start_P_tls));
set_irg_args (res, new_r_Proj(start, mode_T, pn_Start_T_args));
initial_mem = new_r_Proj(start, mode_M, pn_Start_M);
set_irg_initial_mem(res, initial_mem);
ir_graph *new_const_code_irg(void)
{
ir_graph *res = alloc_graph();
- ir_node *bad;
ir_node *body_block;
ir_node *end;
ir_node *end_block;
/* -- The start block -- */
start_block = new_r_Block_noopt(res, 0, NULL);
set_irg_start_block(res, start_block);
- bad = new_r_Bad(res);
- set_irg_bad(res, bad);
no_mem = new_r_NoMem(res);
set_irg_no_mem(res, no_mem);
start = new_r_Start(res);
set_Block_block_visited(body_block, -1);
set_Block_block_visited(start_block, -1);
set_irn_visited(start_block, -1);
- set_irn_visited(bad, -1);
set_irn_visited(no_mem, -1);
return res;
new_identities(res);
/* clone the frame type here for safety */
- irp_reserve_resources(irp, IR_RESOURCE_ENTITY_LINK);
+ irp_reserve_resources(irp, IRP_RESOURCE_ENTITY_LINK);
res->frame_type = clone_frame_type(irg->frame_type);
res->phase_state = irg->phase_state;
/* -- The start block -- */
set_irg_start_block(res, get_new_node(get_irg_start_block(irg)));
- set_irg_bad (res, get_new_node(get_irg_bad(irg)));
set_irg_no_mem (res, get_new_node(get_irg_no_mem(irg)));
set_irg_start (res, get_new_node(get_irg_start(irg)));
res->estimated_node_count = irg->estimated_node_count;
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
- irp_free_resources(irp, IR_RESOURCE_ENTITY_LINK);
+ irp_free_resources(irp, IRP_RESOURCE_ENTITY_LINK);
return res;
}
edges_deactivate(irg);
hook_free_graph(irg);
- if (irg->outs_state != outs_none)
- free_irg_outs(irg);
+ free_irg_outs(irg);
if (irg->frame_type)
free_type(irg->frame_type);
del_identities(irg);
}
#endif
-int get_irg_idx(const ir_graph *irg)
+size_t get_irg_idx(const ir_graph *irg)
{
return irg->index;
}
-ir_node *(get_idx_irn)(ir_graph *irg, unsigned idx)
+ir_node *(get_idx_irn)(const ir_graph *irg, unsigned idx)
{
return _get_idx_irn(irg, idx);
}
_set_irg_frame(irg, node);
}
-ir_node *(get_irg_tls)(const ir_graph *irg)
-{
- return _get_irg_tls(irg);
-}
-
-void (set_irg_tls)(ir_graph *irg, ir_node *node)
-{
- _set_irg_tls(irg, node);
-}
-
ir_node *(get_irg_initial_mem)(const ir_graph *irg)
{
return _get_irg_initial_mem(irg);
_set_irg_args(irg, node);
}
-ir_node *(get_irg_bad)(const ir_graph *irg)
-{
- return _get_irg_bad(irg);
-}
-
-void (set_irg_bad)(ir_graph *irg, ir_node *node)
-{
- _set_irg_bad(irg, node);
-}
-
ir_node *(get_irg_no_mem)(const ir_graph *irg)
{
return _get_irg_no_mem(irg);
_set_irg_frame_type(irg, ftp);
}
-/* Returns the value parameter type of an IR graph. */
-ir_type *get_irg_value_param_type(ir_graph *irg)
-{
- ir_entity *ent = get_irg_entity(irg);
- ir_type *mtp = get_entity_type(ent);
- return get_method_value_param_type(mtp);
-}
-
int get_irg_n_locs(ir_graph *irg)
{
return irg->n_loc - 1;
*
* Implementation is GLIBC specific as is uses the internal _obstack_chunk implementation.
*/
-int node_is_in_irgs_storage(ir_graph *irg, ir_node *n)
+int node_is_in_irgs_storage(const ir_graph *irg, const ir_node *n)
{
struct _obstack_chunk *p;
return _get_irg_pinned(irg);
}
-irg_outs_state (get_irg_outs_state)(const ir_graph *irg)
-{
- return _get_irg_outs_state(irg);
-}
-
-void (set_irg_outs_inconsistent)(ir_graph *irg)
-{
- _set_irg_outs_inconsistent(irg);
-}
-
irg_extblk_info_state (get_irg_extblk_state)(const ir_graph *irg)
{
return _get_irg_extblk_state(irg);
_set_irg_extblk_inconsistent(irg);
}
-irg_dom_state (get_irg_dom_state)(const ir_graph *irg)
-{
- return _get_irg_dom_state(irg);
-}
-
-irg_dom_state (get_irg_postdom_state)(const ir_graph *irg)
-{
- return _get_irg_postdom_state(irg);
-}
-
-void (set_irg_doms_inconsistent)(ir_graph *irg)
-{
- _set_irg_doms_inconsistent(irg);
-}
-
irg_loopinfo_state (get_irg_loopinfo_state)(const ir_graph *irg)
{
return _get_irg_loopinfo_state(irg);
void set_irp_loopinfo_inconsistent(void)
{
- int i;
- for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
+ size_t i, n;
+ for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
set_irg_loopinfo_inconsistent(get_irp_irg(i));
}
}
ir_visited_t inc_max_irg_visited(void)
{
#ifndef NDEBUG
- int i;
+ size_t i;
for (i = 0; i < get_irp_n_irgs(); i++)
assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
#endif
#ifndef NDEBUG
void ir_reserve_resources(ir_graph *irg, ir_resources_t resources)
{
- assert((resources & ~IR_RESOURCE_LOCAL_MASK) == 0);
assert((irg->reserved_resources & resources) == 0);
irg->reserved_resources |= resources;
}