aboutsummaryrefslogtreecommitdiff
path: root/gcc/regrename.h
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-10-19 17:26:26 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2011-10-19 17:26:26 +0000
commit1f234b83b85c579dabe9202bcd07cab448697a69 (patch)
tree4e8270a1658fafb2457bb5416e2aad0869b86a79 /gcc/regrename.h
parent40f73edd0c35d53f57a1c05b1b4a59c4d7a70d60 (diff)
downloadgcc-1f234b83b85c579dabe9202bcd07cab448697a69.zip
gcc-1f234b83b85c579dabe9202bcd07cab448697a69.tar.gz
gcc-1f234b83b85c579dabe9202bcd07cab448697a69.tar.bz2
regrename.h: New file.
* regrename.h: New file. * regrename.c: Include it. Also include "emit-rtl.h". (struct du_head, struct du_chain, du_head_p DEF_VEC and DEF_VEC_ALLOC_P): Move to regrename.h. (do_replace): Remove declaration. (insn_rr): New variable. (cur_operand): New static variable. (regrename_chain_from_id): Renamed from chain_from_id and no longer static. All callers changed. (record_operand_use): New static function. (scan_rtx_reg): Use it. (find_best_rename_reg): New function, broken out of rename_chains. (rename_chains): Use it. Don't update chain regno and nregs here, ... (regrename_do_replace): ... do it here instead. Renamed from do_replace, and no longer static. All callers changed. (regrename_analyze): No longer static. New arg bb_mask. All callers changed. If bb_mask is nonzero, use it to limit the number of basic blocks we analyze. If we failed to analyze a block, clear insn operand data. (record_out_operands): New arg insn_info. Update cur_operand if it is nonnull. (build_def_use): If insn_rr is nonnull, pass an insn_info to record_out_operands, and update cur_operand here as well. (regrename_init, regrename_finish): New functions. (regrename_optimize): Use them. * Makefile.in (regrename.o): Adjust dependencies. From-SVN: r180198
Diffstat (limited to 'gcc/regrename.h')
-rw-r--r--gcc/regrename.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/gcc/regrename.h b/gcc/regrename.h
new file mode 100644
index 0000000..f3969a1
--- /dev/null
+++ b/gcc/regrename.h
@@ -0,0 +1,101 @@
+/* This file contains definitions for the register renamer.
+ Copyright (C) 2011
+ 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/>. */
+
+#ifndef GCC_REGRENAME_H
+#define GCC_REGRENAME_H
+
+/* We keep linked lists of DU_HEAD structures, each of which describes
+ a chain of occurrences of a reg. */
+struct du_head
+{
+ /* The next chain. */
+ struct du_head *next_chain;
+ /* The first and last elements of this chain. */
+ struct du_chain *first, *last;
+ /* Describes the register being tracked. */
+ unsigned regno;
+ int nregs;
+
+ /* A unique id to be used as an index into the conflicts bitmaps. */
+ unsigned id;
+ /* A bitmap to record conflicts with other chains. */
+ bitmap_head conflicts;
+ /* Conflicts with untracked hard registers. */
+ HARD_REG_SET hard_conflicts;
+
+ /* Nonzero if the chain crosses a call. */
+ unsigned int need_caller_save_reg:1;
+ /* Nonzero if the register is used in a way that prevents renaming,
+ such as the SET_DEST of a CALL_INSN or an asm operand that used
+ to be a hard register. */
+ unsigned int cannot_rename:1;
+};
+
+typedef struct du_head *du_head_p;
+DEF_VEC_P (du_head_p);
+DEF_VEC_ALLOC_P (du_head_p, heap);
+
+/* This struct describes a single occurrence of a register. */
+struct du_chain
+{
+ /* Links to the next occurrence of the register. */
+ struct du_chain *next_use;
+
+ /* The insn where the register appears. */
+ rtx insn;
+ /* The location inside the insn. */
+ rtx *loc;
+ /* The register class required by the insn at this location. */
+ ENUM_BITFIELD(reg_class) cl : 16;
+};
+
+/* This struct describes data gathered during regrename_analyze about
+ a single operand of an insn. */
+typedef struct
+{
+ /* The number of chains recorded for this operand. */
+ int n_chains;
+ /* Holds either the chain for the operand itself, or for the registers in
+ a memory operand. */
+ struct du_chain *chains[MAX_REGS_PER_ADDRESS];
+ struct du_head *heads[MAX_REGS_PER_ADDRESS];
+} operand_rr_info;
+
+/* A struct to hold a vector of operand_rr_info structures describing the
+ operands of an insn. */
+typedef struct
+{
+ operand_rr_info *op_info;
+} insn_rr_info;
+
+DEF_VEC_O (insn_rr_info);
+DEF_VEC_ALLOC_O (insn_rr_info, heap);
+
+extern VEC(insn_rr_info, heap) *insn_rr;
+
+extern void regrename_init (bool);
+extern void regrename_finish (void);
+extern void regrename_analyze (bitmap);
+extern du_head_p regrename_chain_from_id (unsigned int);
+extern int find_best_rename_reg (du_head_p, enum reg_class, HARD_REG_SET *,
+ int);
+extern void regrename_do_replace (du_head_p, int);
+
+#endif