PR c++/86288
[official-gcc.git] / gcc / regrename.h
blobb0ac47191e06823508821dd82ec5bf1956e494d7
1 /* This file contains definitions for the register renamer.
2 Copyright (C) 2011-2018 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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/>. */
20 #ifndef GCC_REGRENAME_H
21 #define GCC_REGRENAME_H
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
27 /* The next chain. */
28 struct du_head *next_chain;
29 /* The first and last elements of this chain. */
30 struct du_chain *first, *last;
31 /* The chain that this chain is tied to. */
32 struct du_head *tied_chain;
33 /* Describes the register being tracked. */
34 unsigned regno;
35 int nregs;
37 /* A unique id to be used as an index into the conflicts bitmaps. */
38 unsigned id;
39 /* A bitmap to record conflicts with other chains. */
40 bitmap_head conflicts;
41 /* Conflicts with untracked hard registers. */
42 HARD_REG_SET hard_conflicts;
44 /* Nonzero if the chain crosses a call. */
45 unsigned int need_caller_save_reg:1;
46 /* Nonzero if the register is used in a way that prevents renaming,
47 such as the SET_DEST of a CALL_INSN or an asm operand that used
48 to be a hard register. */
49 unsigned int cannot_rename:1;
50 /* Nonzero if the chain has already been renamed. */
51 unsigned int renamed:1;
53 /* Fields for use by target code. */
54 unsigned int target_data_1;
55 unsigned int target_data_2;
58 typedef struct du_head *du_head_p;
60 /* This struct describes a single occurrence of a register. */
61 struct du_chain
63 /* Links to the next occurrence of the register. */
64 struct du_chain *next_use;
66 /* The insn where the register appears. */
67 rtx_insn *insn;
68 /* The location inside the insn. */
69 rtx *loc;
70 /* The register class required by the insn at this location. */
71 ENUM_BITFIELD(reg_class) cl : 16;
74 /* This struct describes data gathered during regrename_analyze about
75 a single operand of an insn. */
76 struct operand_rr_info
78 /* The number of chains recorded for this operand. */
79 short n_chains;
80 bool failed;
81 /* Holds either the chain for the operand itself, or for the registers in
82 a memory operand. */
83 struct du_chain *chains[MAX_REGS_PER_ADDRESS];
84 struct du_head *heads[MAX_REGS_PER_ADDRESS];
87 /* A struct to hold a vector of operand_rr_info structures describing the
88 operands of an insn. */
89 struct insn_rr_info
91 operand_rr_info *op_info;
95 extern vec<insn_rr_info> insn_rr;
97 extern void regrename_init (bool);
98 extern void regrename_finish (void);
99 extern void regrename_analyze (bitmap);
100 extern du_head_p regrename_chain_from_id (unsigned int);
101 extern int find_rename_reg (du_head_p, enum reg_class, HARD_REG_SET *, int,
102 bool);
103 extern bool regrename_do_replace (du_head_p, int);
104 extern reg_class regrename_find_superclass (du_head_p, int *,
105 HARD_REG_SET *);
107 #endif