]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add a no_register_allocation target hook.
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Nov 2014 12:14:27 +0000 (12:14 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Nov 2014 12:14:27 +0000 (12:14 +0000)
* target.def (no_register_allocation): New data hook.
* doc/tm.texi.in: Add @hook TARGET_NO_REGISTER_ALLOCATION.
* doc/tm.texi: Regenerate.
* ira.c (gate_ira): New function.
(pass_data_ira): Set has_gate.
(pass_ira): Add a gate function.
(pass_data_reload): Likewise.
(pass_reload): Add a gate function.
(pass_ira): Use it.
* reload1.c (eliminate_regs): If reg_eliminate_is NULL, assert that
no register allocation happens on the target and return.
* final.c (alter_subreg): Ensure register is not a pseudo before
calling simplify_subreg.
(output_operand): Assert that x isn't a pseudo only if doing
register allocation.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217122 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/final.c
gcc/ira.c
gcc/reload1.c
gcc/target.def

index bb2b59ee04b440bfb7f261a10c9b4a9e1f6e555b..ff9ead618a42111a9cddfd6bf1071b08b0d76f9b 100644 (file)
@@ -1,5 +1,21 @@
 2014-11-05  Bernd Schmidt  <bernds@codesourcery.com>
 
+       * target.def (no_register_allocation): New data hook.
+       * doc/tm.texi.in: Add @hook TARGET_NO_REGISTER_ALLOCATION.
+       * doc/tm.texi: Regenerate.
+       * ira.c (gate_ira): New function.
+       (pass_data_ira): Set has_gate.
+       (pass_ira): Add a gate function.
+       (pass_data_reload): Likewise.
+       (pass_reload): Add a gate function.
+       (pass_ira): Use it.
+       * reload1.c (eliminate_regs): If reg_eliminate_is NULL, assert that
+       no register allocation happens on the target and return.
+       * final.c (alter_subreg): Ensure register is not a pseudo before
+       calling simplify_subreg.
+       (output_operand): Assert that x isn't a pseudo only if doing
+       register allocation.
+
        * dbxout.c (dbxout_symbol): Don't call eliminate_regs on decls for
        global vars.
 
index 0d1f1499968efb2de0de367d09c3feff0c65774f..dbca62dd8eda9f33110812db3e279474211cd594 100644 (file)
@@ -9323,11 +9323,19 @@ True if the @code{DW_AT_comp_dir} attribute should be emitted for each  compilat
 @end deftypevr
 
 @deftypevr {Target Hook} bool TARGET_DELAY_SCHED2
-True if sched2 is not to be run at its normal place.  This usually means it will be run as part of machine-specific reorg.
+True if sched2 is not to be run at its normal place.
+This usually means it will be run as part of machine-specific reorg.
 @end deftypevr
 
 @deftypevr {Target Hook} bool TARGET_DELAY_VARTRACK
-True if vartrack is not to be run at its normal place.  This usually means it will be run as part of machine-specific reorg.
+True if vartrack is not to be run at its normal place.
+This usually means it will be run as part of machine-specific reorg.
+@end deftypevr
+
+@deftypevr {Target Hook} bool TARGET_NO_REGISTER_ALLOCATION
+True if register allocation and the passes
+following it should not be run.  Usually true only for virtual assembler
+targets.
 @end deftypevr
 
 @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
index 679b3d113b039f05518bf17ae6766e84dd30f548..b732f1f671cd1e488ce5a38fbccf64cec164cf23 100644 (file)
@@ -6948,6 +6948,8 @@ tables, and hence is desirable if it works.
 
 @hook TARGET_DELAY_VARTRACK
 
+@hook TARGET_NO_REGISTER_ALLOCATION
+
 @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
 A C statement to issue assembly directives that create a difference
 @var{lab1} minus @var{lab2}, using an integer of the given @var{size}.
index f7ede57da44d8a47ff89305f7081631a6568cb31..e958a5202462dfcfc96d06a43a59daac27edae88 100644 (file)
@@ -3189,7 +3189,7 @@ alter_subreg (rtx *xp, bool final_p)
       else
        *xp = adjust_address_nv (y, GET_MODE (x), offset);
     }
-  else
+  else if (REG_P (y) && HARD_REGISTER_P (y))
     {
       rtx new_rtx = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
                                     SUBREG_BYTE (x));
@@ -3857,7 +3857,8 @@ output_operand (rtx x, int code ATTRIBUTE_UNUSED)
     x = alter_subreg (&x, true);
 
   /* X must not be a pseudo reg.  */
-  gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
+  if (!targetm.no_register_allocation)
+    gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
 
   targetm.asm_out.print_operand (asm_out_file, x, code);
 
index 630df40ead673f4398b9ad6394979e9800710461..9c9e71d1be105c35ead24e5b43129067b77ee86a 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5498,6 +5498,10 @@ public:
   {}
 
   /* opt_pass methods: */
+  virtual bool gate (function *)
+    {
+      return !targetm.no_register_allocation;
+    }
   virtual unsigned int execute (function *)
     {
       ira (dump_file);
@@ -5537,6 +5541,10 @@ public:
   {}
 
   /* opt_pass methods: */
+  virtual bool gate (function *)
+    {
+      return !targetm.no_register_allocation;
+    }
   virtual unsigned int execute (function *)
     {
       do_reload ();
index dab8a7532e01333c53e0b440ba9c7edd05054f1f..7d5bad51d88ad5b165179e56762dd7580f9cfee4 100644 (file)
@@ -2968,6 +2968,11 @@ eliminate_regs_1 (rtx x, machine_mode mem_mode, rtx insn,
 rtx
 eliminate_regs (rtx x, machine_mode mem_mode, rtx insn)
 {
+  if (reg_eliminate == NULL)
+    {
+      gcc_assert (targetm.no_register_allocation);
+      return x;
+    }
   return eliminate_regs_1 (x, mem_mode, insn, false, false);
 }
 
index 23cae25cafe3192712ad8dd6299443a17c62f011..de203c3146b54d064df60de051b359acc80786e9 100644 (file)
@@ -5421,15 +5421,21 @@ DEFHOOKPOD
  bool, false)
 
 DEFHOOKPOD
-(delay_sched2, "True if sched2 is not to be run at its normal place.  \
+(delay_sched2, "True if sched2 is not to be run at its normal place.\n\
 This usually means it will be run as part of machine-specific reorg.",
 bool, false)
 
 DEFHOOKPOD
-(delay_vartrack, "True if vartrack is not to be run at its normal place.  \
+(delay_vartrack, "True if vartrack is not to be run at its normal place.\n\
 This usually means it will be run as part of machine-specific reorg.",
 bool, false)
 
+DEFHOOKPOD
+(no_register_allocation, "True if register allocation and the passes\n\
+following it should not be run.  Usually true only for virtual assembler\n\
+targets.",
+bool, false)
+
 /* Leave the boolean fields at the end.  */
 
 /* Functions related to mode switching.  */