summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-29 23:23:10 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-29 23:23:10 +0000
commitf8cec994b23cf83b1ced51137571e3bd62a71323 (patch)
tree83f36160f250583112fc7d3f297197b4e5b12755
parent971f8266c94e387c1aae0d5d3703979d597ccd91 (diff)
downloadgcc-f8cec994b23cf83b1ced51137571e3bd62a71323.tar.gz
* config/nvptx/nvptx.md (nvptx_reorg_subreg): New fn, broken out of ...
(nvptx_reorg): Here. Keep the non-subreg pieces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225154 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/nvptx/nvptx.c46
2 files changed, 39 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6aaa0b0c06c..fc4a4424645 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * config/nvptx/nvptx.md (nvptx_reorg_subreg): New fn, broken out of ...
+ (nvptx_reorg): Here. Keep the non-subreg pieces.
+
2015-06-29 H.J. Lu <hongjiu.lu@intel.com>
* config/gnu-user.h (GNU_USER_TARGET_ENDFILE_SPEC): Use
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 43f197f17a1..3d6315a76b0 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -1,3 +1,4 @@
+
/* Target code for NVPTX.
Copyright (C) 2014-2015 Free Software Foundation, Inc.
Contributed by Bernd Schmidt <bernds@codesourcery.com>
@@ -1877,20 +1878,11 @@ get_replacement (struct reg_replace *r)
conversion copyin/copyout instructions. */
static void
-nvptx_reorg (void)
+nvptx_reorg_subreg (void)
{
struct reg_replace qiregs, hiregs, siregs, diregs;
rtx_insn *insn, *next;
- /* We are freeing block_for_insn in the toplev to keep compatibility
- with old MDEP_REORGS that are not CFG based. Recompute it now. */
- compute_bb_for_insn ();
-
- df_clear_flags (DF_LR_RUN_DCE);
- df_analyze ();
-
- thread_prologue_and_epilogue_insns ();
-
qiregs.n_allocated = 0;
hiregs.n_allocated = 0;
siregs.n_allocated = 0;
@@ -1966,14 +1958,44 @@ nvptx_reorg (void)
validate_change (insn, recog_data.operand_loc[i], new_reg, false);
}
}
+}
- int maxregs = max_reg_num ();
+/* PTX-specific reorganization
+ 1) mark now-unused registers, so function begin doesn't declare
+ unused registers.
+ 2) replace subregs with suitable sequences.
+*/
+
+static void
+nvptx_reorg (void)
+{
+ struct reg_replace qiregs, hiregs, siregs, diregs;
+ rtx_insn *insn, *next;
+
+ /* We are freeing block_for_insn in the toplev to keep compatibility
+ with old MDEP_REORGS that are not CFG based. Recompute it now. */
+ compute_bb_for_insn ();
+
+ thread_prologue_and_epilogue_insns ();
+
+ df_clear_flags (DF_LR_RUN_DCE);
+ df_set_flags (DF_NO_INSN_RESCAN | DF_NO_HARD_REGS);
+ df_analyze ();
regstat_init_n_sets_and_refs ();
- for (int i = LAST_VIRTUAL_REGISTER + 1; i < maxregs; i++)
+ int max_regs = max_reg_num ();
+
+ /* Mark unused regs as unused. */
+ for (int i = LAST_VIRTUAL_REGISTER + 1; i < max_regs; i++)
if (REG_N_SETS (i) == 0 && REG_N_REFS (i) == 0)
regno_reg_rtx[i] = const0_rtx;
+
+ /* Replace subregs. */
+ nvptx_reorg_subreg (max_regs);
+
regstat_free_n_sets_and_refs ();
+
+ df_finish_pass (true);
}
/* Handle a "kernel" attribute; arguments as in