aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2010-09-03 21:21:14 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2010-09-03 21:21:14 +0000
commit2bfec3687642f933affbfadf580be47150925585 (patch)
tree580ce409671fc81be7bfde8ec05ed37ef541fa6f /gcc/fortran
parentd158303227fdca143db5decf983978f635be2ba9 (diff)
downloadgcc-2bfec3687642f933affbfadf580be47150925585.zip
gcc-2bfec3687642f933affbfadf580be47150925585.tar.gz
gcc-2bfec3687642f933affbfadf580be47150925585.tar.bz2
dump_parse_tree (gfc_run_passes): Call optimize_namespace instead of optimize_code.
2010-09-03 Thomas Koenig <tkoenig@gcc.gnu.org> * dump_parse_tree (gfc_run_passes): Call optimize_namespace instead of optimize_code. (optimize_namespace): New function. 2010-09-03 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/trim_optimize_2.f90: New test. From-SVN: r163846
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/frontend-passes.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 27ff0fe..14c5fe4 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
/* Forward declarations. */
static void strip_function_call (gfc_expr *);
+static void optimize_namespace (gfc_namespace *);
static void optimize_assignment (gfc_code *);
static void optimize_expr_0 (gfc_expr *);
static bool optimize_expr (gfc_expr *);
@@ -41,10 +42,21 @@ static void optimize_actual_arglist (gfc_actual_arglist *);
optimization pass is run. */
void
-gfc_run_passes (gfc_namespace * ns)
+gfc_run_passes (gfc_namespace *ns)
{
if (optimize)
- optimize_code (ns->code);
+ optimize_namespace (ns);
+}
+
+/* Optimize a namespace, including all contained namespaces. */
+
+static void
+optimize_namespace (gfc_namespace *ns)
+{
+ optimize_code (ns->code);
+
+ for (ns = ns->contained; ns; ns = ns->sibling)
+ optimize_namespace (ns);
}
static void