--- /dev/null
+#
+# Project: libFIRM
+# File name: ir/ir/Makefile.in
+# Purpose:
+# Author: Boris Boesler, Till Riedel
+# Modified by:
+# Created:
+# CVS-ID: $Id$
+# Copyright: (c) 1999-2004 Universität Karlsruhe
+# Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+#
+
+top_srcdir := @top_srcdir@
+srcdir = @srcdir@
+topdir = ../..
+subdir := ir/ir
+
+INSTALL_HEADERS = tailrec.h
+
+SOURCES = $(INSTALL_HEADERS)
+
+SOURCES += Makefile.in \
+ tailrec.c
+
+include $(topdir)/MakeRules
+
+CPPFLAGS += -I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/common \
+ -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr -I$(top_srcdir)/ir/tv \
+ -I$(top_srcdir)/ir/debug -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st \
+ -I$(top_srcdir)/ir/stat
+
+include $(top_srcdir)/MakeTargets
+
+all: subdir.o
#include <assert.h>
#include "tailrec.h"
#include "array.h"
+#include "irprog.h"
#include "irgwalk.h"
#include "irgmod.h"
#include "irop.h"
set_optimize(rem);
}
-/**
+/*
* convert simple tail-calls into loops
*/
-void optimize_tail_rec_irg(ir_graph *irg)
+void opt_tail_rec_irg(ir_graph *irg)
{
ir_node *end_block = irg->end_block;
int n_preds;
do_opt_tail_rec(irg, rets, n_tail_calls);
}
-/**
+/*
* optimize tail recursion away
*/
-void optimize_tail_recursion(void)
+void opt_tail_recursion(void)
{
+ int i;
+
if (! get_opt_tail_recursion() || ! get_opt_optimize())
return;
for (i = 0; i < get_irp_n_irgs(); i++) {
current_ir_graph = get_irp_irg(i);
- optimize_tail_rec_irg(current_ir_graph);
+ opt_tail_rec_irg(current_ir_graph);
}
}
--- /dev/null
+/*
+ * Project: libFIRM
+ * File name: ir/opt/tailrec.h
+ * Purpose: Tail-recursion call optimization.
+ * Author: Michael Beck
+ * Created: 08.06.2004
+ * CVS-ID: $Id$
+ * Copyright: (c) 1998-2004 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
+
+/**
+ * @file tailrec.h
+ *
+ * Tail-recursion call optimization.
+ *
+ * @author Michael Beck
+ */
+
+# ifndef _TAILREC_H_
+# define _TAILREC_H_
+
+# include "irgraph.h"
+
+/**
+ * Optimizes simple tail-recursion calls by
+ * converting them into loops. Depends on the flag opt_tail_recursion.
+ *
+ * @param irg the graph to be optimized
+ */
+void opt_tail_rec_irg(ir_graph *irg);
+
+/*
+ * Optimize tail-recursion calls for all IR-Graphs.
+ */
+void opt_tail_recursion(void);
+
+# endif /* _TAILREC_H_ */