diff mbox

[alpha] : Use alpha-passes.def to register passes.

Message ID CAFULd4ZqBBJo-_rE_Jn8u=xA=Dxk23NUHXowUV-ikiAn6ProwA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Oct. 11, 2016, 4:41 p.m. UTC
2016-10-11  Uros Bizjak  <ubizjak@gmail.com>

    * config/alpha/alpha-passes.def: New file.
    * config/alpha/t-alpha: New file.
    * config/alpha/alpha-protos.h (gcc::context, rtl_opt_pass): Declare.
    (make_pass_handle_trap_shadows): New prototype.
    (make_pass_align_insns): Ditto.
    * config/alpha/alpha.c (alpha_option_override): Don't register
    passes here.
    * config.gcc (alpha*-*-*) Add alpha/t-alpha to tmake_file.

Bootstrapped and regression tested on alphaev68-linux-gnu.

Committed to mainline SVN.

BTW - Jakub, it looks there is a bug in awk script. If the order of
pass insertion commands in alpha/alpha-passes.def is reversed to:

  INSERT_PASS_AFTER (pass_convert_to_eh_region_ranges, 1,
pass_handle_trap_shadows);
  INSERT_PASS_BEFORE (pass_shorten_branches, 1, pass_align_insns);

then the second pass is not registered for some reason. This can be
seen in generated pass-instances.def (also when building crosscompiler
to alpha-linux-gnu), where pass_align_insns insertion is simply
missing from what is the correct pass order:

          NEXT_PASS (pass_convert_to_eh_region_ranges, 1);
  NEXT_PASS ( pass_handle_trap_shadows, 1);
  NEXT_PASS ( pass_align_insns, 1);
          NEXT_PASS (pass_shorten_branches, 1);

(There is no problem with the pass insertion commands order, as
committed in the patch).

BTW2: There is a superfluous space generated after the opening paren.

Uros.
diff mbox

Patch

Index: config/alpha/alpha-passes.def
===================================================================
--- config/alpha/alpha-passes.def	(nonexistent)
+++ config/alpha/alpha-passes.def	(working copy)
@@ -0,0 +1,21 @@ 
+/* Description of target passes for DEC Alpha
+   Copyright (C) 2016 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+  INSERT_PASS_BEFORE (pass_shorten_branches, 1, pass_align_insns);
+  INSERT_PASS_AFTER (pass_convert_to_eh_region_ranges, 1, pass_handle_trap_shadows);
Index: config/alpha/alpha-protos.h
===================================================================
--- config/alpha/alpha-protos.h	(revision 240976)
+++ config/alpha/alpha-protos.h	(working copy)
@@ -112,3 +112,9 @@  extern rtx unicosmk_add_call_info_word (rtx);
 extern bool some_small_symbolic_operand_int (rtx);
 extern int tls_symbolic_operand_1 (rtx, int, int);
 extern rtx resolve_reload_operand (rtx);
+
+namespace gcc { class context; }
+class rtl_opt_pass;
+
+extern rtl_opt_pass *make_pass_handle_trap_shadows (gcc::context *);
+extern rtl_opt_pass *make_pass_align_insns (gcc::context *);
Index: config/alpha/alpha.c
===================================================================
--- config/alpha/alpha.c	(revision 240976)
+++ config/alpha/alpha.c	(working copy)
@@ -374,18 +374,6 @@  alpha_option_override (void)
       64, 64, 16*1024 }
   };
 
-  opt_pass *pass_handle_trap_shadows = make_pass_handle_trap_shadows (g);
-  struct register_pass_info handle_trap_shadows_info
-    = { pass_handle_trap_shadows, "eh_ranges",
-	1, PASS_POS_INSERT_AFTER
-      };
-
-  opt_pass *pass_align_insns = make_pass_align_insns (g);
-  struct register_pass_info align_insns_info
-    = { pass_align_insns, "shorten",
-	1, PASS_POS_INSERT_BEFORE
-      };
-
   int const ct_size = ARRAY_SIZE (cpu_table);
   int line_size = 0, l1_size = 0, l2_size = 0;
   int i;
@@ -610,9 +598,6 @@  alpha_option_override (void)
     target_flags |= MASK_LONG_DOUBLE_128;
 #endif
 
-  /* This needs to be done at start up.  It's convenient to do it here.  */
-  register_pass (&handle_trap_shadows_info);
-  register_pass (&align_insns_info);
 }
 
 /* Implement targetm.override_options_after_change.  */
Index: config/alpha/t-alpha
===================================================================
--- config/alpha/t-alpha	(nonexistent)
+++ config/alpha/t-alpha	(working copy)
@@ -0,0 +1,19 @@ 
+# Copyright (C) 2016 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+PASSES_EXTRA += $(srcdir)/config/alpha/alpha-passes.def
Index: config.gcc
===================================================================
--- config.gcc	(revision 240976)
+++ config.gcc	(working copy)
@@ -972,15 +972,17 @@  aarch64*-*-linux*)
 	;;
 alpha*-*-linux*)
 	tm_file="elfos.h ${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
-	tmake_file="${tmake_file} alpha/t-linux"
+	tmake_file="${tmake_file} alpha/t-linux alpha/t-alpha"
 	extra_options="${extra_options} alpha/elf.opt"
 	;;
 alpha*-*-freebsd*)
 	tm_file="elfos.h ${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
+	tmake_file="${tmake_file} alpha/t-alpha"
 	extra_options="${extra_options} alpha/elf.opt"
 	;;
 alpha*-*-netbsd*)
 	tm_file="elfos.h ${tm_file} netbsd.h alpha/elf.h netbsd-elf.h alpha/netbsd.h"
+	tmake_file="${tmake_file} alpha/t-alpha"
 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt \
 		       alpha/elf.opt"
 	;;
@@ -987,12 +989,13 @@  alpha*-*-netbsd*)
 alpha*-*-openbsd*)
 	tm_defines="${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_FUNCTION_SIZE OBSD_HAS_DECLARE_OBJECT"
 	tm_file="elfos.h alpha/alpha.h alpha/elf.h openbsd.h openbsd-stdint.h alpha/openbsd.h openbsd-libpthread.h"
+	tmake_file="${tmake_file} alpha/t-alpha"
 	extra_options="${extra_options} openbsd.opt alpha/elf.opt"
 	# default x-alpha is only appropriate for dec-osf.
 	;;
 alpha*-dec-*vms*)
 	tm_file="${tm_file} vms/vms.h alpha/vms.h"
-	tmake_file="${tmake_file} alpha/t-vms"
+	tmake_file="${tmake_file} alpha/t-vms alpha/t-alpha"
 	;;
 arc*-*-elf*)
 	extra_headers="arc-simd.h"