#include "irgmod.h"
#include "irgwalk.h"
#include "irflag_t.h"
-
+#include "irtools.h"
/* Return the current state of the interprocedural view. */
ip_view_state get_irp_ip_view_state(void) {
for (call = get_irn_link(get_irg_end(irg)); call; call = get_irn_link(call)) {
if (get_irn_op(call) != op_Call) continue;
for (j = get_Call_n_callees(call) - 1; j >= 0; --j) {
- entity * ent = get_Call_callee(call, j);
- if (get_entity_irg(ent)) {
- irg_data_t * data = get_entity_link(ent);
+ entity * ent = get_Call_callee(call, j);
+ if (get_entity_irg(ent)) {
+ irg_data_t * data = get_entity_link(ent);
# ifndef CATE_jni
- assert(get_entity_irg(ent) && data);
- ++data->count;
+ assert(get_entity_irg(ent) && data);
+ ++data->count;
# endif /* ndef CATE_jni */
- } else {
- set_entity_link(ent, NULL);
- }
+ } else {
+ set_entity_link(ent, NULL);
+ }
}
}
}
}
-
-static INLINE void clear_link(ir_node * node, void * env) {
- set_irn_link(node, NULL);
-}
-
/*
static INLINE ir_node * tail(ir_node * node) {
ir_node * link;
link(start, get_irg_frame(irg));
link(start, get_irg_globals(irg));
/* walk */
- irg_walk_graph(irg, clear_link, (irg_walk_func *) collect_phicallproj_walker, &end);
+ irg_walk_graph(irg, firm_clear_link, (irg_walk_func *) collect_phicallproj_walker, &end);
}
}
int n_ret = 0;
for (i = get_Block_n_cfgpreds(end_block) - 1; i >= 0; --i) {
- if (get_irn_op(cfgpred_arr[i]) == op_Return) {
+ if (is_Return(cfgpred_arr[i])) {
if (ret_arr) {
- ARR_APP1(ir_node *, ret_arr, cfgpred_arr[i]);
+ ARR_APP1(ir_node *, ret_arr, cfgpred_arr[i]);
} else {
- ret_arr = NEW_ARR_F(ir_node *, 1);
- ret_arr[0] = cfgpred_arr[i];
+ ret_arr = NEW_ARR_F(ir_node *, 1);
+ ret_arr[0] = cfgpred_arr[i];
}
++n_ret;
}
int n_except = 0;
ir_node ** cfgpred_arr = get_Block_cfgpred_arr(end_block);
for (i = get_Block_n_cfgpreds(end_block) - 1; i >= 0; --i) {
- if (get_irn_op(cfgpred_arr[i]) != op_Return) {
+ if (! is_Return(cfgpred_arr[i])) {
if (except_arr) {
- ARR_APP1(ir_node *, except_arr, cfgpred_arr[i]);
+ ARR_APP1(ir_node *, except_arr, cfgpred_arr[i]);
} else {
- except_arr = NEW_ARR_F(ir_node *, 1);
- except_arr[0] = cfgpred_arr[i];
+ except_arr = NEW_ARR_F(ir_node *, 1);
+ except_arr[0] = cfgpred_arr[i];
}
++n_except;
}
data->except = new_EndExcept();
/* mem */
for (i = n_except - 1; i >= 0; --i) {
- ir_node * node = skip_Proj(skip_Tuple(except_arr[i]));
- if (get_irn_op(node) == op_Call) {
- in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 3);
- } else if (get_irn_op(node) == op_Raise) {
- in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 1);
+ ir_node *node = skip_Proj(skip_Tuple(except_arr[i]));
+ ir_op *op = get_irn_op(node);
+ if (op == op_Call) {
+ in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, pn_Call_M_except);
+ } else if (op == op_Raise) {
+ in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, pn_Raise_M);
+ } else if (op == op_CopyB) {
+ in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, pn_CopyB_M_except);
+ } else if (op == op_Bound) {
+ in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, pn_Bound_M_except);
} else {
- assert(is_fragile_op(node));
- /* We rely that all cfops have the memory output at the same position. */
- in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 0);
+ assert(is_fragile_op(node));
+ /* We rely that all cfops have the memory output at the same position. */
+ in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 0);
}
}
data->except_mem = new_Phi(n_except, in, mode_M);
set_nodes_block(proj, except_block);
exchange(proj, new_Break());
set_irg_current_block(current_ir_graph, pre_block);
- set_irn_n(except_block, 0, new_Proj(call, mode_X, 1));
+ set_irn_n(except_block, 0, new_Proj(call, mode_X, pn_Call_X_except));
set_irg_current_block(current_ir_graph, post_block);
}
current_ir_graph = get_irp_irg(i);
for (node = get_irn_link(get_irg_end(current_ir_graph)); node; node = get_irn_link(node)) {
if (get_irn_op(node) == op_Call) {
- int j, n_callees = get_Call_n_callees(node);
- for (j = 0; j < n_callees; ++j)
- if (get_entity_irg(get_Call_callee(node, j)))
- break;
- if (j < n_callees) /* There is an entity with a graph */
- construct_call(node);
+ int j, n_callees = get_Call_n_callees(node);
+ for (j = 0; j < n_callees; ++j)
+ if (get_entity_irg(get_Call_callee(node, j)))
+ break;
+ if (j < n_callees) /* There is an entity with a graph */
+ construct_call(node);
}
}
}
if (get_irp_ip_view_state() != ip_view_no) {
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph * irg = get_irp_irg(i);
- irg_walk_graph(irg, destruct_walker, clear_link, NULL);
+ irg_walk_graph(irg, destruct_walker, firm_clear_link, NULL);
set_irg_frame (irg, skip_Id(get_irg_frame(irg)));
set_irg_globals (irg, skip_Id(get_irg_globals(irg)));