/* Funcionality for inlining */
/**********************************************************************/
-/* Copy node for inlineing. Copies the node by calling copy_node and
- then updates the entity if it's a local one. env must be a pointer
- to the frame type of the procedure. The new entities must be in
- the link field of the entities. */
+/* Copy node for inlineing. Updates attributes that change when
+ * inlineing but not for dead node elimination.
+ *
+ * Copies the node by calling copy_node and then updates the entity if
+ * it's a local one. env must be a pointer of the frame type of the
+ * inlined procedure. The new entities must be in the link field of
+ * the entities. */
static INLINE void
copy_node_inline (ir_node *n, void *env) {
ir_node *new;
if (get_entity_owner(get_Sel_entity(n)) == frame_tp) {
set_Sel_entity(new, get_entity_link(get_Sel_entity(n)));
}
+ } else if (get_irn_op(n) == op_Block) {
+ new = get_new_node (n);
+ new->attr.block.irg = current_ir_graph;
}
}
-#include "irdump.h"
void inline_method(ir_node *call, ir_graph *called_graph) {
ir_node *pre_call;
if (get_irn_op(cf_op) == op_Proj) {
cf_op = get_Proj_pred(cf_op);
if ((get_irn_op(cf_op) == op_Tuple) && (cf_op == call)) {
- // There are unoptimized tuples from inlineing before when no exc
+ // There are unoptimized tuples from inlineing before when no exc
assert(get_Proj_proj(get_Block_cfgpred(end_bl, i)) == pn_Call_X_except);
cf_op = get_Tuple_pred(cf_op, pn_Call_X_except);
assert(get_irn_op(cf_op) == op_Jmp);
cf_pred[j] = get_Block_cfgpred(end_bl, j-get_Block_n_cfgpreds(bl) +1);
set_irn_in(end_bl, arity, cf_pred);
free(cf_pred);
+ // Remove the exception pred from post-call Tuple.
+ set_Tuple_pred(call, pn_Call_X_except, new_Bad());
}
}
/* will be executed only if needed. */
/********************************************************************/
-#include "irdump.h"
-
static pdeq *worklist; /* worklist of ir_node*s */
/* Find the earliest correct block for N. --- Place N into the