source: trunk/third/gcc/regs.h @ 11288

Revision 11288, 8.0 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r11287, which included commits to RCS files with non-trunk default branches.
Line 
1/* Define per-register tables for data flow info and register allocation.
2   Copyright (C) 1987, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING.  If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA.  */
20
21
22
23#define REG_BYTES(R) mode_size[(int) GET_MODE (R)]
24
25/* Get the number of consecutive hard regs required to hold the REG rtx R.
26   When something may be an explicit hard reg, REG_SIZE is the only
27   valid way to get this value.  You cannot get it from the regno.  */
28
29#define REG_SIZE(R) \
30  ((mode_size[(int) GET_MODE (R)] + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
31
32#ifndef SMALL_REGISTER_CLASSES
33#define SMALL_REGISTER_CLASSES 0
34#endif
35
36/* Maximum register number used in this function, plus one.  */
37
38extern int max_regno;
39
40/* Maximum number of SCRATCH rtx's in each block of this function.  */
41
42extern int max_scratch;
43
44/* Register information indexed by register number */
45typedef struct reg_info_def {
46                                /* fields set by reg_scan */
47  int first_uid;                /* UID of first insn to use (REG n) */
48  int last_uid;                 /* UID of last insn to use (REG n) */
49  int last_note_uid;            /* UID of last note to use (REG n) */
50
51                                /* fields set by both reg_scan and flow_analysis */
52  int sets;                     /* # of times (REG n) is set */
53
54                                /* fields set by flow_analysis */
55  int refs;                     /* # of times (REG n) is used or set */
56  int deaths;                   /* # of times (REG n) dies */
57  int live_length;              /* # of instructions (REG n) is live */
58  int calls_crossed;            /* # of calls (REG n) is live across */
59  int basic_block;              /* # of basic blocks (REG n) is used in */
60  char changes_size;            /* whether (SUBREG (REG n)) changes size */
61} reg_info;
62
63extern reg_info *reg_n_info;
64
65/* Indexed by n, gives number of times (REG n) is used or set.
66   References within loops may be counted more times.  */
67
68#define REG_N_REFS(N) (reg_n_info[(N)].refs)
69
70/* Indexed by n, gives number of times (REG n) is set.
71   ??? both regscan and flow allocate space for this.  We should settle
72   on just copy.  */
73
74#define REG_N_SETS(N) (reg_n_info[(N)].sets)
75
76/* Indexed by N, gives number of insns in which register N dies.
77   Note that if register N is live around loops, it can die
78   in transitions between basic blocks, and that is not counted here.
79   So this is only a reliable indicator of how many regions of life there are
80   for registers that are contained in one basic block.  */
81
82#define REG_N_DEATHS(N) (reg_n_info[(N)].deaths)
83
84/* Indexed by N; says whether a pseudo register N was ever used
85   within a SUBREG that changes the size of the reg.  Some machines prohibit
86   such objects to be in certain (usually floating-point) registers.  */
87
88#define REG_CHANGES_SIZE(N) (reg_n_info[(N)].changes_size)
89
90/* Get the number of consecutive words required to hold pseudo-reg N.  */
91
92#define PSEUDO_REGNO_SIZE(N) \
93  ((GET_MODE_SIZE (PSEUDO_REGNO_MODE (N)) + UNITS_PER_WORD - 1)         \
94   / UNITS_PER_WORD)
95
96/* Get the number of bytes required to hold pseudo-reg N.  */
97
98#define PSEUDO_REGNO_BYTES(N) \
99  GET_MODE_SIZE (PSEUDO_REGNO_MODE (N))
100
101/* Get the machine mode of pseudo-reg N.  */
102
103#define PSEUDO_REGNO_MODE(N) GET_MODE (regno_reg_rtx[N])
104
105/* Indexed by N, gives number of CALL_INSNS across which (REG n) is live.  */
106
107#define REG_N_CALLS_CROSSED(N) (reg_n_info[(N)].calls_crossed)
108
109/* Total number of instructions at which (REG n) is live.
110   The larger this is, the less priority (REG n) gets for
111   allocation in a hard register (in global-alloc).
112   This is set in flow.c and remains valid for the rest of the compilation
113   of the function; it is used to control register allocation.
114
115   local-alloc.c may alter this number to change the priority.
116
117   Negative values are special.
118   -1 is used to mark a pseudo reg which has a constant or memory equivalent
119   and is used infrequently enough that it should not get a hard register.
120   -2 is used to mark a pseudo reg for a parameter, when a frame pointer
121   is not required.  global.c makes an allocno for this but does
122   not try to assign a hard register to it.  */
123
124#define REG_LIVE_LENGTH(N) (reg_n_info[(N)].live_length)
125
126/* Vector of substitutions of register numbers,
127   used to map pseudo regs into hardware regs.
128
129   This can't be folded into reg_n_info without changing all of the
130   machine dependent directories, since the reload functions
131   in the machine dependent files access it.  */
132
133extern short *reg_renumber;
134
135/* Vector indexed by hardware reg
136   saying whether that reg is ever used.  */
137
138extern char regs_ever_live[FIRST_PSEUDO_REGISTER];
139
140/* Vector indexed by hardware reg giving its name.  */
141
142extern char *reg_names[FIRST_PSEUDO_REGISTER];
143
144/* For each hard register, the widest mode object that it can contain.
145   This will be a MODE_INT mode if the register can hold integers.  Otherwise
146   it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the
147   register.  */
148
149extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
150
151/* Vector indexed by regno; gives uid of first insn using that reg.
152   This is computed by reg_scan for use by cse and loop.
153   It is sometimes adjusted for subsequent changes during loop,
154   but not adjusted by cse even if cse invalidates it.  */
155
156#define REGNO_FIRST_UID(N) (reg_n_info[(N)].first_uid)
157
158/* Vector indexed by regno; gives uid of last insn using that reg.
159   This is computed by reg_scan for use by cse and loop.
160   It is sometimes adjusted for subsequent changes during loop,
161   but not adjusted by cse even if cse invalidates it.
162   This is harmless since cse won't scan through a loop end.  */
163
164#define REGNO_LAST_UID(N) (reg_n_info[(N)].last_uid)
165
166/* Similar, but includes insns that mention the reg in their notes.  */
167
168#define REGNO_LAST_NOTE_UID(N) (reg_n_info[(N)].last_note_uid)
169
170/* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
171   After rtl generation, it is 1 plus the largest register number used.  */
172
173extern int reg_rtx_no;
174
175/* Vector indexed by regno; contains 1 for a register is considered a pointer.
176   Reloading, etc. will use a pointer register rather than a non-pointer
177   as the base register in an address, when there is a choice of two regs.  */
178
179extern char *regno_pointer_flag;
180#define REGNO_POINTER_FLAG(REGNO) regno_pointer_flag[REGNO]
181extern int regno_pointer_flag_length;
182
183/* List made of EXPR_LIST rtx's which gives pairs of pseudo registers
184   that have to go in the same hard reg.  */
185extern rtx regs_may_share;
186
187/* Vector mapping pseudo regno into the REG rtx for that register.
188   This is computed by reg_scan.  */
189
190extern rtx *regno_reg_rtx;
191
192/* Flag set by local-alloc or global-alloc if they decide to allocate
193   something in a call-clobbered register.  */
194
195extern int caller_save_needed;
196
197/* Predicate to decide whether to give a hard reg to a pseudo which
198   is referenced REFS times and would need to be saved and restored
199   around a call CALLS times.  */
200
201#ifndef CALLER_SAVE_PROFITABLE
202#define CALLER_SAVE_PROFITABLE(REFS, CALLS)  (4 * (CALLS) < (REFS))
203#endif
204
205/* On most machines a register class is likely to be spilled if it
206   only has one register.  */
207#ifndef CLASS_LIKELY_SPILLED_P
208#define CLASS_LIKELY_SPILLED_P(CLASS) (reg_class_size[(int) (CLASS)] == 1)
209#endif
210
211/* Allocated in local_alloc.  */
212
213/* A list of SCRATCH rtl allocated by local-alloc.  */
214extern rtx *scratch_list;
215/* The basic block in which each SCRATCH is used.  */
216extern int *scratch_block;
217/* The length of the arrays pointed to by scratch_block and scratch_list.  */
218extern int scratch_list_length;
219
220/* Allocate reg_n_info tables */
221extern void allocate_reg_info PROTO((int, int, int));
Note: See TracBrowser for help on using the repository browser.