re PR debug/31899 (-g and using declaration causing ICE in reference_to_unused)
[official-gcc.git] / gcc / ra.h
blob52a1cc28beb876e9009113286bf70272b2fb2335
1 /* Define per-register tables for data flow info and register allocation.
2 Copyright (C) 2007 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_RA_H
21 #define GCC_RA_H
23 #include "regs.h"
25 struct allocno
27 int reg;
28 /* Gives the number of consecutive hard registers needed by that
29 pseudo reg. */
30 int size;
32 /* Number of calls crossed by each allocno. */
33 int calls_crossed;
35 /* Number of calls that might throw crossed by each allocno. */
36 int throwing_calls_crossed;
38 /* Number of refs to each allocno. */
39 int n_refs;
41 /* Frequency of uses of each allocno. */
42 int freq;
44 /* Guess at live length of each allocno.
45 This is actually the max of the live lengths of the regs. */
46 int live_length;
48 /* Set of hard regs conflicting with allocno N. */
50 HARD_REG_SET hard_reg_conflicts;
52 /* Set of hard regs preferred by allocno N.
53 This is used to make allocnos go into regs that are copied to or from them,
54 when possible, to reduce register shuffling. */
56 HARD_REG_SET hard_reg_preferences;
58 /* Similar, but just counts register preferences made in simple copy
59 operations, rather than arithmetic. These are given priority because
60 we can always eliminate an insn by using these, but using a register
61 in the above list won't always eliminate an insn. */
63 HARD_REG_SET hard_reg_copy_preferences;
65 /* Similar to hard_reg_preferences, but includes bits for subsequent
66 registers when an allocno is multi-word. The above variable is used for
67 allocation while this is used to build reg_someone_prefers, below. */
69 HARD_REG_SET hard_reg_full_preferences;
71 /* Set of hard registers that some later allocno has a preference for. */
73 HARD_REG_SET regs_someone_prefers;
75 #ifdef STACK_REGS
76 /* Set to true if allocno can't be allocated in the stack register. */
77 bool no_stack_reg;
78 #endif
80 extern struct allocno *allocno;
82 /* In ra-conflict.c */
84 /* Number of pseudo-registers which are candidates for allocation. */
86 extern int max_allocno;
88 /* max_allocno by max_allocno array of bits, recording whether two
89 allocno's conflict (can't go in the same hardware register).
91 `conflicts' is symmetric after the call to mirror_conflicts. */
93 extern HOST_WIDE_INT *conflicts;
95 /* Number of ints required to hold max_allocno bits.
96 This is the length of a row in `conflicts'. */
98 extern int allocno_row_words;
100 /* Indexed by (pseudo) reg number, gives the allocno, or -1
101 for pseudo registers which are not to be allocated. */
103 extern int *reg_allocno;
105 extern void global_conflicts (void);
107 /* In global.c */
109 /* For any allocno set in ALLOCNO_SET, set ALLOCNO to that allocno,
110 and execute CODE. */
111 #define EXECUTE_IF_SET_IN_ALLOCNO_SET(ALLOCNO_SET, ALLOCNO, CODE) \
112 do { \
113 int i_; \
114 int allocno_; \
115 HOST_WIDE_INT *p_ = (ALLOCNO_SET); \
117 for (i_ = allocno_row_words - 1, allocno_ = 0; i_ >= 0; \
118 i_--, allocno_ += HOST_BITS_PER_WIDE_INT) \
120 unsigned HOST_WIDE_INT word_ = (unsigned HOST_WIDE_INT) *p_++; \
122 for ((ALLOCNO) = allocno_; word_; word_ >>= 1, (ALLOCNO)++) \
124 if (word_ & 1) \
125 {CODE;} \
128 } while (0)
130 extern void ra_init_live_subregs (bool, sbitmap *, int *, int, rtx reg);
133 #endif /* GCC_RA_H */