first pubplic release
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 8 Jun 2004 15:15:53 +0000 (15:15 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 8 Jun 2004 15:15:53 +0000 (15:15 +0000)
[r3030]

ir/opt/Makefile.in [new file with mode: 0644]
ir/opt/tailrec.c
ir/opt/tailrec.h [new file with mode: 0644]

diff --git a/ir/opt/Makefile.in b/ir/opt/Makefile.in
new file mode 100644 (file)
index 0000000..5fffdc7
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# 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
index 509b2ab..8b95a17 100644 (file)
@@ -16,6 +16,7 @@
 #include <assert.h>
 #include "tailrec.h"
 #include "array.h"
+#include "irprog.h"
 #include "irgwalk.h"
 #include "irgmod.h"
 #include "irop.h"
@@ -226,10 +227,10 @@ static void do_opt_tail_rec(ir_graph *irg, ir_node *rets, int n_tail_calls)
   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;
@@ -326,17 +327,19 @@ void optimize_tail_rec_irg(ir_graph *irg)
   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);
   }
 }
diff --git a/ir/opt/tailrec.h b/ir/opt/tailrec.h
new file mode 100644 (file)
index 0000000..880d554
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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_ */