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-2024 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along 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. */
26{
27public:
28 /* The next chain. */
30 /* The first and last elements of this chain. */
31 struct du_chain *first, *last;
32 /* The chain that this chain is tied to. */
34 /* Describes the register being tracked. */
35 unsigned regno;
36 int nregs;
37
38 /* A unique id to be used as an index into the conflicts bitmaps. */
39 unsigned id;
40 /* A bitmap to record conflicts with other chains. */
42 /* Conflicts with untracked hard registers. */
44 /* Which registers are fully or partially clobbered by the calls that
45 the chain crosses. */
47
48 /* A bitmask of ABIs used by the calls that the chain crosses. */
49 unsigned int call_abis : NUM_ABI_IDS;
50 /* Nonzero if the register is used in a way that prevents renaming,
51 such as the SET_DEST of a CALL_INSN or an asm operand that used
52 to be a hard register. */
53 unsigned int cannot_rename:1;
54 /* Nonzero if the chain has already been renamed. */
55 unsigned int renamed:1;
56
57 /* Fields for use by target code. */
58 unsigned int target_data_1;
59 unsigned int target_data_2;
60};
61
62typedef class du_head *du_head_p;
63
64/* This struct describes a single occurrence of a register. */
66{
67 /* Links to the next occurrence of the register. */
69
70 /* The insn where the register appears. */
72 /* The location inside the insn. */
74 /* The register class required by the insn at this location. */
75 ENUM_BITFIELD(reg_class) cl : 16;
76};
77
78/* This struct describes data gathered during regrename_analyze about
79 a single operand of an insn. */
81{
82 /* The number of chains recorded for this operand. */
83 short n_chains;
84 bool failed;
85 /* Holds either the chain for the operand itself, or for the registers in
86 a memory operand. */
87 struct du_chain *chains[MAX_REGS_PER_ADDRESS];
88 class du_head *heads[MAX_REGS_PER_ADDRESS];
89};
90
91/* A struct to hold a vector of operand_rr_info structures describing the
92 operands of an insn. */
97
98
100
101extern void regrename_init (bool);
102extern void regrename_finish (void);
103extern void regrename_analyze (bitmap, bool = true);
104extern du_head_p regrename_chain_from_id (unsigned int);
105extern int find_rename_reg (du_head_p, enum reg_class, HARD_REG_SET *, int,
106 bool);
108extern reg_class regrename_find_superclass (du_head_p, int *,
109 HARD_REG_SET *);
110
111#endif
Definition bitmap.h:328
Definition regrename.h:26
unsigned int call_abis
Definition regrename.h:49
unsigned id
Definition regrename.h:39
unsigned int target_data_1
Definition regrename.h:58
int nregs
Definition regrename.h:36
unsigned regno
Definition regrename.h:35
struct du_chain * first
Definition regrename.h:31
unsigned int renamed
Definition regrename.h:55
HARD_REG_SET hard_conflicts
Definition regrename.h:43
unsigned int cannot_rename
Definition regrename.h:53
HARD_REG_SET call_clobber_mask
Definition regrename.h:46
class du_head * tied_chain
Definition regrename.h:33
unsigned int target_data_2
Definition regrename.h:59
class du_head * next_chain
Definition regrename.h:29
bitmap_head conflicts
Definition regrename.h:41
struct du_chain * last
Definition regrename.h:31
class bitmap_head * bitmap
Definition coretypes.h:51
const size_t NUM_ABI_IDS
Definition function-abi.h:31
HARD_REG_ELT_TYPE HARD_REG_SET
Definition hard-reg-set.h:47
vec< insn_rr_info > insn_rr
Definition regrename.cc:107
reg_class regrename_find_superclass(du_head_p, int *, HARD_REG_SET *)
Definition regrename.cc:466
int find_rename_reg(du_head_p, enum reg_class, HARD_REG_SET *, int, bool)
Definition regrename.cc:386
void regrename_init(bool)
Definition regrename.cc:1967
void regrename_analyze(bitmap, bool=true)
Definition regrename.cc:725
void regrename_finish(void)
Definition regrename.cc:1977
bool regrename_do_replace(du_head_p, int)
class du_head * du_head_p
Definition regrename.h:62
du_head_p regrename_chain_from_id(unsigned int)
Definition regrename.cc:144
Definition regrename.h:66
rtx_insn * insn
Definition regrename.h:71
enum reg_class cl
Definition regrename.h:75
rtx * loc
Definition regrename.h:73
struct du_chain * next_use
Definition regrename.h:68
Definition regrename.h:94
operand_rr_info * op_info
Definition regrename.h:95
Definition regrename.h:81
struct du_chain * chains[MAX_REGS_PER_ADDRESS]
Definition regrename.h:87
class du_head * heads[MAX_REGS_PER_ADDRESS]
Definition regrename.h:88
bool failed
Definition regrename.h:84
short n_chains
Definition regrename.h:83
Definition rtl.h:312
Definition rtl.h:546
Definition vec.h:450