projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more debug info
[libfirm]
/
ir
/
opt
/
opt_inline.c
diff --git
a/ir/opt/opt_inline.c
b/ir/opt/opt_inline.c
index
00e6036
..
66a47d9
100644
(file)
--- a/
ir/opt/opt_inline.c
+++ b/
ir/opt/opt_inline.c
@@
-472,7
+472,7
@@
void dead_node_elimination(ir_graph *irg) {
graveyard_obst = irg->obst;
/* A new obstack, where the reachable nodes will be copied to. */
graveyard_obst = irg->obst;
/* A new obstack, where the reachable nodes will be copied to. */
- rebirth_obst =
xmalloc(sizeof(*rebirth_obst)
);
+ rebirth_obst =
XMALLOC(struct obstack
);
irg->obst = rebirth_obst;
obstack_init(irg->obst);
irg->last_node_idx = 0;
irg->obst = rebirth_obst;
obstack_init(irg->obst);
irg->last_node_idx = 0;
@@
-663,7
+663,7
@@
static void dead_node_subst_hook(void *context, ir_graph *irg, ir_node *old, ir_
* Make a new Survive DCE environment.
*/
survive_dce_t *new_survive_dce(void) {
* Make a new Survive DCE environment.
*/
survive_dce_t *new_survive_dce(void) {
- survive_dce_t *res =
xmalloc(sizeof(res[0])
);
+ survive_dce_t *res =
XMALLOC(survive_dce_t
);
obstack_init(&res->obst);
res->places = pmap_create();
res->new_places = NULL;
obstack_init(&res->obst);
res->places = pmap_create();
res->new_places = NULL;
@@
-1068,8
+1068,8
@@
int inline_method(ir_node *call, ir_graph *called_graph) {
arity = get_Block_n_cfgpreds(end_bl); /* arity = n_exc + n_ret */
n_res = get_method_n_ress(get_Call_type(call));
arity = get_Block_n_cfgpreds(end_bl); /* arity = n_exc + n_ret */
n_res = get_method_n_ress(get_Call_type(call));
- res_pred =
xmalloc(n_res * sizeof(*res_pred)
);
- cf_pred =
xmalloc(arity * sizeof(*res_pred)
);
+ res_pred =
XMALLOCN(ir_node*, n_res
);
+ cf_pred =
XMALLOCN(ir_node*, arity
);
set_irg_current_block(irg, post_bl); /* just to make sure */
set_irg_current_block(irg, post_bl); /* just to make sure */
@@
-1209,9
+1209,9
@@
int inline_method(ir_node *call, ir_graph *called_graph) {
n_exc++;
}
}
n_exc++;
}
}
- main_end_bl = get_irg_end_block(irg);
+ main_end_bl
= get_irg_end_block(irg);
main_end_bl_arity = get_irn_arity(main_end_bl);
main_end_bl_arity = get_irn_arity(main_end_bl);
- end_preds
= xmalloc((n_exc + main_end_bl_arity) * sizeof(*end_preds)
);
+ end_preds
= XMALLOCN(ir_node*, n_exc + main_end_bl_arity
);
for (i = 0; i < main_end_bl_arity; ++i)
end_preds[i] = get_irn_n(main_end_bl, i);
for (i = 0; i < main_end_bl_arity; ++i)
end_preds[i] = get_irn_n(main_end_bl, i);
@@
-2012,8
+2012,7
@@
static ir_graph **create_irg_list(void) {
compute_callgraph();
last_irg = 0;
compute_callgraph();
last_irg = 0;
- irgs = xmalloc(n_irgs * sizeof(*irgs));
- memset(irgs, 0, sizeof(n_irgs * sizeof(*irgs)));
+ irgs = XMALLOCNZ(ir_graph*, n_irgs);
callgraph_walk(NULL, callgraph_walker, NULL);
assert(n_irgs == last_irg);
callgraph_walk(NULL, callgraph_walker, NULL);
assert(n_irgs == last_irg);
@@
-2022,8
+2021,7
@@
static ir_graph **create_irg_list(void) {
}
/**
}
/**
- * Push a call onto the priority list if its
- * benefice is big enough.
+ * Push a call onto the priority list if its benefice is big enough.
*
* @param pqueue the priority queue of calls
* @param call the call entry
*
* @param pqueue the priority queue of calls
* @param call the call entry
@@
-2037,11
+2035,12
@@
static void maybe_push_call(pqueue_t *pqueue, call_entry *call,
irg_inline_property prop = get_irg_inline_property(callee);
int benefice = calc_inline_benefice(call, callee);
irg_inline_property prop = get_irg_inline_property(callee);
int benefice = calc_inline_benefice(call, callee);
-
DB((dbg, LEVEL_2, "In %+F Call %+F to %+F has benefice %d\n",
-
get_irn_irg(call->call), call->call, callee, benefice));
+ DB((dbg, LEVEL_2, "In %+F Call %+F to %+F has benefice %d\n",
+ get_irn_irg(call->call), call->call, callee, benefice));
- if (
benefice < inline_threshold && prop < irg_inline_forced)
+ if (
prop < irg_inline_forced && benefice < inline_threshold) {
return;
return;
+ }
pqueue_put(pqueue, call, benefice);
}
pqueue_put(pqueue, call, benefice);
}
@@
-2274,22
+2273,18
@@
void inline_functions(unsigned maxsize, int inline_threshold) {
env = get_irg_link(irg);
if (env->got_inline) {
/* this irg got calls inlined: optimize it */
env = get_irg_link(irg);
if (env->got_inline) {
/* this irg got calls inlined: optimize it */
-
- if (0) {
- /* scalar replacement does not work well with Tuple nodes, so optimize them away */
- optimize_graph_df(irg);
-
+ if (get_opt_combo()) {
+ if (env->local_vars) {
+ scalar_replacement_opt(irg);
+ }
+ combo(irg);
+ } else {
if (env->local_vars) {
if (scalar_replacement_opt(irg)) {
optimize_graph_df(irg);
}
}
optimize_cf(irg);
if (env->local_vars) {
if (scalar_replacement_opt(irg)) {
optimize_graph_df(irg);
}
}
optimize_cf(irg);
- } else {
- if (env->local_vars) {
- scalar_replacement_opt(irg);
- }
- combo(irg);
}
}
if (env->got_inline || (env->n_callers_orig != env->n_callers)) {
}
}
if (env->got_inline || (env->n_callers_orig != env->n_callers)) {