]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/epiphany/mode-switch-use.c
Update copyright years.
[thirdparty/gcc.git] / gcc / config / epiphany / mode-switch-use.c
index ef89004e39b25fa4819c5cc322f0ea23a450227a..1591e193eb58f8cd4af9874515df351d8f7d1028 100644 (file)
@@ -1,6 +1,6 @@
 /* Insert USEs in instructions that require mode switching.
    This should probably be merged into mode-switching.c .
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2020 Free Software Foundation, Inc.
    Contributed by Embecosm on behalf of Adapteva, Inc.
 
 This file is part of GCC.
@@ -19,19 +19,19 @@ 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/>.  */
 
+#define IN_TARGET_CODE 1
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
+#include "backend.h"
 #include "rtl.h"
-#include "function.h"
+#include "df.h"
+#include "memmodel.h"
+#include "tm_p.h"
 #include "emit-rtl.h"
 #include "tree-pass.h"
 #include "insn-attr.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "tm_p.h"
-#include "df.h"
 
 #ifndef TARGET_INSERT_MODE_SWITCH_USE
 #define TARGET_INSERT_MODE_SWITCH_USE NULL
@@ -43,13 +43,13 @@ insert_uses (void)
   static const int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING;
 #define N_ENTITIES ARRAY_SIZE (num_modes)
   int e;
-  void (*target_insert_mode_switch_use) (rtx insn, int, int)
+  void (*target_insert_mode_switch_use) (rtx_insn *insn, int, int)
     = TARGET_INSERT_MODE_SWITCH_USE;
 
   for (e = N_ENTITIES - 1; e >= 0; e--)
     {
       int no_mode = num_modes[e];
-      rtx insn;
+      rtx_insn *insn;
       int mode;
 
       if (!OPTIMIZE_MODE_SWITCHING (e))
@@ -58,7 +58,7 @@ insert_uses (void)
        {
          if (!INSN_P (insn))
            continue;
-         mode = MODE_NEEDED (e, insn);
+         mode = epiphany_mode_needed (e, insn);
          if (mode == no_mode)
            continue;
          if (target_insert_mode_switch_use)
@@ -71,22 +71,37 @@ insert_uses (void)
   return 0;
 }
 
-struct rtl_opt_pass pass_mode_switch_use =
+namespace {
+
+const pass_data pass_data_mode_switch_use =
 {
- {
-  RTL_PASS,
-  "mode_switch_use",                   /* name */
-  OPTGROUP_NONE,                        /* optinfo_flags */
-  NULL,                                        /* gate */
-  insert_uses,                         /* execute */
-  NULL,                                        /* sub */
-  NULL,                                        /* next */
-  0,                                   /* static_pass_number */
-  TV_NONE,                             /* tv_id */
-  0,                                   /* properties_required */
-  0,                                   /* properties_provided */
-  0,                                   /* properties_destroyed */
-  0,                                   /* todo_flags_start */
-  0,                                   /* todo_flags_finish */
- }
+  RTL_PASS, /* type */
+  "mode_switch_use", /* name */
+  OPTGROUP_NONE, /* optinfo_flags */
+  TV_NONE, /* tv_id */
+  0, /* properties_required */
+  0, /* properties_provided */
+  0, /* properties_destroyed */
+  0, /* todo_flags_start */
+  0, /* todo_flags_finish */
 };
+
+class pass_mode_switch_use : public rtl_opt_pass
+{
+public:
+  pass_mode_switch_use(gcc::context *ctxt)
+    : rtl_opt_pass(pass_data_mode_switch_use, ctxt)
+  {}
+
+  /* opt_pass methods: */
+  virtual unsigned int execute (function *) { return insert_uses (); }
+
+}; // class pass_mode_switch_use
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_mode_switch_use (gcc::context *ctxt)
+{
+  return new pass_mode_switch_use (ctxt);
+}