GCC Middle and Back End API Reference
regrename.h
Go to the documentation of this file.
1 /* This file contains definitions for the register renamer.
2  Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10 
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
19 
20 #ifndef GCC_REGRENAME_H
21 #define GCC_REGRENAME_H
22 
23 /* We keep linked lists of DU_HEAD structures, each of which describes
24  a chain of occurrences of a reg. */
25 struct du_head
26 {
27  /* The next chain. */
29  /* The first and last elements of this chain. */
30  struct du_chain *first, *last;
31  /* Describes the register being tracked. */
32  unsigned regno;
33  int nregs;
34 
35  /* A unique id to be used as an index into the conflicts bitmaps. */
36  unsigned id;
37  /* A bitmap to record conflicts with other chains. */
39  /* Conflicts with untracked hard registers. */
41 
42  /* Nonzero if the chain crosses a call. */
43  unsigned int need_caller_save_reg:1;
44  /* Nonzero if the register is used in a way that prevents renaming,
45  such as the SET_DEST of a CALL_INSN or an asm operand that used
46  to be a hard register. */
47  unsigned int cannot_rename:1;
48 };
49 
50 typedef struct du_head *du_head_p;
51 
52 /* This struct describes a single occurrence of a register. */
53 struct du_chain
54 {
55  /* Links to the next occurrence of the register. */
56  struct du_chain *next_use;
57 
58  /* The insn where the register appears. */
60  /* The location inside the insn. */
61  rtx *loc;
62  /* The register class required by the insn at this location. */
63  ENUM_BITFIELD(reg_class) cl : 16;
64 };
65 
66 /* This struct describes data gathered during regrename_analyze about
67  a single operand of an insn. */
68 typedef struct
69 {
70  /* The number of chains recorded for this operand. */
71  int n_chains;
72  /* Holds either the chain for the operand itself, or for the registers in
73  a memory operand. */
74  struct du_chain *chains[MAX_REGS_PER_ADDRESS];
75  struct du_head *heads[MAX_REGS_PER_ADDRESS];
77 
78 /* A struct to hold a vector of operand_rr_info structures describing the
79  operands of an insn. */
80 typedef struct
81 {
83 } insn_rr_info;
84 
85 
87 
88 extern void regrename_init (bool);
89 extern void regrename_finish (void);
90 extern void regrename_analyze (bitmap);
91 extern du_head_p regrename_chain_from_id (unsigned int);
92 extern int find_best_rename_reg (du_head_p, enum reg_class, HARD_REG_SET *,
93  int);
94 extern void regrename_do_replace (du_head_p, int);
95 
96 #endif