* @author Michael Beck
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
#include <string.h>
#include <assert.h>
#include "debug.h"
#include "iroptimize.h"
#include "scalar_replace.h"
-#include "array.h"
+#include "array_t.h"
#include "irprog_t.h"
#include "irgwalk.h"
#include "irgmod.h"
#include "trouts.h"
#include "irouts.h"
#include "irhooks.h"
-#include "xmalloc.h"
+#include "ircons_t.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg);
if (op == op_Proj) {
ir_node *start = get_Proj_pred(pred);
- if (get_irn_op(start) == op_Start) {
+ if (is_Start(start)) {
if (get_Proj_proj(pred) == pn_Start_T_args) {
/* found Proj(ProjT(Start)) */
set_irn_link(node, data->proj_data);
* ok, we are here, so we have build and collected all needed Phi's
* now exchange all Projs into links to Phi
*/
- for (p = data.proj_m; p; p = n) {
- n = get_irn_link(p);
- exchange(p, phis[0]);
- }
+ exchange(data.proj_m, phis[0]);
for (p = data.proj_data; p; p = n) {
long proj = get_Proj_proj(p);
modes[i] = mode;
if (env->variants[i] == TR_ADD) {
- set_value(i, new_Const(mode, get_mode_null(mode)));
+ set_value(i, new_Const(get_mode_null(mode)));
} else if (env->variants[i] == TR_MUL) {
- set_value(i, new_Const(mode, get_mode_one(mode)));
+ set_value(i, new_Const(get_mode_one(mode)));
}
}
mature_immBlock(start_block);
* @return non-zero if it's ok to do tail recursion
*/
static int check_lifetime_of_locals(ir_graph *irg) {
- ir_node *irg_frame, *irg_val_param_base;
+ ir_node *irg_frame;
int i;
+ ir_type *frame_tp = get_irg_frame_type(irg);
irg_frame = get_irg_frame(irg);
for (i = get_irn_n_outs(irg_frame) - 1; i >= 0; --i) {
ir_node *succ = get_irn_out(irg_frame, i);
- if (is_Sel(succ) && is_address_taken(succ))
- return 0;
- }
-
- /* Check if we have compound arguments.
- For now, we cannot handle them, */
- irg_val_param_base = get_irg_value_param_base(irg);
- if (get_irn_n_outs(irg_val_param_base) > 0)
- return 0;
+ if (is_Sel(succ)) {
+ /* Check if we have compound arguments.
+ For now, we cannot handle them, */
+ if (get_entity_owner(get_Sel_entity(succ)) != frame_tp)
+ return 0;
+ if (is_address_taken(succ))
+ return 0;
+ }
+ }
return 1;
}
return TR_BAD;
case iro_Sub:
- /* try additive, but return value mut be left */
+ /* try additive, but return value must be left */
a = get_Sub_left(irn);
if (get_irn_MacroBlock(a) != get_irn_MacroBlock(call)) {
/* we are outside, ignore */
/* check if it's a recursive call */
call_ptr = get_Call_ptr(call);
- if (! is_SymConst_addr_ent(call_ptr))
+ if (! is_Global(call_ptr))
continue;
- ent = get_SymConst_entity(call_ptr);
+ ent = get_Global_entity(call_ptr);
if (!ent || get_entity_irg(ent) != irg)
continue;
current_ir_graph = irg;
+ ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
if (opt_tail_rec_irg(irg))
++n_opt_applications;
+
+ ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
}
DB((dbg, LEVEL_1, "Performed tail recursion for %d of %d graphs\n",