Mercurial > hg > CbC > CbC_gcc
comparison gcc/regs.h @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
1 /* Define per-register tables for data flow info and register allocation. | 1 /* Define per-register tables for data flow info and register allocation. |
2 Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, | 2 Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, |
3 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008 Free Software | 3 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2010 Free Software |
4 Foundation, Inc. | 4 Foundation, Inc. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
8 GCC is free software; you can redistribute it and/or modify it under | 8 GCC is free software; you can redistribute it and/or modify it under |
20 <http://www.gnu.org/licenses/>. */ | 20 <http://www.gnu.org/licenses/>. */ |
21 | 21 |
22 #ifndef GCC_REGS_H | 22 #ifndef GCC_REGS_H |
23 #define GCC_REGS_H | 23 #define GCC_REGS_H |
24 | 24 |
25 #include "obstack.h" | 25 #include "machmode.h" |
26 #include "hard-reg-set.h" | 26 #include "hard-reg-set.h" |
27 #include "basic-block.h" | |
28 | 27 |
29 #define REG_BYTES(R) mode_size[(int) GET_MODE (R)] | 28 #define REG_BYTES(R) mode_size[(int) GET_MODE (R)] |
30 | 29 |
31 /* When you only have the mode of a pseudo register before it has a hard | 30 /* When you only have the mode of a pseudo register before it has a hard |
32 register chosen for it, this reports the size of each hard register | 31 register chosen for it, this reports the size of each hard register |
213 machine dependent directories, since the reload functions | 212 machine dependent directories, since the reload functions |
214 in the machine dependent files access it. */ | 213 in the machine dependent files access it. */ |
215 | 214 |
216 extern short *reg_renumber; | 215 extern short *reg_renumber; |
217 | 216 |
218 /* Vector indexed by machine mode saying whether there are regs of that mode. */ | |
219 | |
220 extern bool have_regs_of_mode [MAX_MACHINE_MODE]; | |
221 | |
222 /* For each hard register, the widest mode object that it can contain. | |
223 This will be a MODE_INT mode if the register can hold integers. Otherwise | |
224 it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the | |
225 register. */ | |
226 | |
227 extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER]; | |
228 | |
229 /* Flag set by local-alloc or global-alloc if they decide to allocate | 217 /* Flag set by local-alloc or global-alloc if they decide to allocate |
230 something in a call-clobbered register. */ | 218 something in a call-clobbered register. */ |
231 | 219 |
232 extern int caller_save_needed; | 220 extern int caller_save_needed; |
233 | 221 |
235 is referenced REFS times and would need to be saved and restored | 223 is referenced REFS times and would need to be saved and restored |
236 around a call CALLS times. */ | 224 around a call CALLS times. */ |
237 | 225 |
238 #ifndef CALLER_SAVE_PROFITABLE | 226 #ifndef CALLER_SAVE_PROFITABLE |
239 #define CALLER_SAVE_PROFITABLE(REFS, CALLS) (4 * (CALLS) < (REFS)) | 227 #define CALLER_SAVE_PROFITABLE(REFS, CALLS) (4 * (CALLS) < (REFS)) |
240 #endif | |
241 | |
242 /* On most machines a register class is likely to be spilled if it | |
243 only has one register. */ | |
244 #ifndef CLASS_LIKELY_SPILLED_P | |
245 #define CLASS_LIKELY_SPILLED_P(CLASS) (reg_class_size[(int) (CLASS)] == 1) | |
246 #endif | 228 #endif |
247 | 229 |
248 /* Select a register mode required for caller save of hard regno REGNO. */ | 230 /* Select a register mode required for caller save of hard regno REGNO. */ |
249 #ifndef HARD_REGNO_CALLER_SAVE_MODE | 231 #ifndef HARD_REGNO_CALLER_SAVE_MODE |
250 #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ | 232 #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ |
255 These must not be call used registers. */ | 237 These must not be call used registers. */ |
256 #ifndef HARD_REGNO_CALL_PART_CLOBBERED | 238 #ifndef HARD_REGNO_CALL_PART_CLOBBERED |
257 #define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) 0 | 239 #define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) 0 |
258 #endif | 240 #endif |
259 | 241 |
260 /* 1 if the corresponding class does contain register of given | |
261 mode. */ | |
262 extern char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE]; | |
263 | |
264 typedef unsigned short move_table[N_REG_CLASSES]; | 242 typedef unsigned short move_table[N_REG_CLASSES]; |
265 | 243 |
266 /* Maximum cost of moving from a register in one class to a register | 244 /* Target-dependent globals. */ |
267 in another class. */ | 245 struct target_regs { |
268 extern move_table *move_cost[MAX_MACHINE_MODE]; | 246 /* For each starting hard register, the number of consecutive hard |
269 | 247 registers that a given machine mode occupies. */ |
270 /* Specify number of hard registers given machine mode occupy. */ | 248 unsigned char x_hard_regno_nregs[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; |
271 extern unsigned char hard_regno_nregs[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; | 249 |
272 | 250 /* For each hard register, the widest mode object that it can contain. |
273 /* Similar, but here we don't have to move if the first index is a | 251 This will be a MODE_INT mode if the register can hold integers. Otherwise |
274 subset of the second so in that case the cost is zero. */ | 252 it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the |
275 extern move_table *may_move_in_cost[MAX_MACHINE_MODE]; | 253 register. */ |
276 | 254 enum machine_mode x_reg_raw_mode[FIRST_PSEUDO_REGISTER]; |
277 /* Similar, but here we don't have to move if the first index is a | 255 |
278 superset of the second so in that case the cost is zero. */ | 256 /* Vector indexed by machine mode saying whether there are regs of |
279 extern move_table *may_move_out_cost[MAX_MACHINE_MODE]; | 257 that mode. */ |
258 bool x_have_regs_of_mode[MAX_MACHINE_MODE]; | |
259 | |
260 /* 1 if the corresponding class contains a register of the given mode. */ | |
261 char x_contains_reg_of_mode[N_REG_CLASSES][MAX_MACHINE_MODE]; | |
262 | |
263 /* Maximum cost of moving from a register in one class to a register | |
264 in another class. Based on TARGET_REGISTER_MOVE_COST. */ | |
265 move_table *x_move_cost[MAX_MACHINE_MODE]; | |
266 | |
267 /* Similar, but here we don't have to move if the first index is a | |
268 subset of the second so in that case the cost is zero. */ | |
269 move_table *x_may_move_in_cost[MAX_MACHINE_MODE]; | |
270 | |
271 /* Similar, but here we don't have to move if the first index is a | |
272 superset of the second so in that case the cost is zero. */ | |
273 move_table *x_may_move_out_cost[MAX_MACHINE_MODE]; | |
274 | |
275 /* Keep track of the last mode we initialized move costs for. */ | |
276 int x_last_mode_for_init_move_cost; | |
277 | |
278 /* Record for each mode whether we can move a register directly to or | |
279 from an object of that mode in memory. If we can't, we won't try | |
280 to use that mode directly when accessing a field of that mode. */ | |
281 char x_direct_load[NUM_MACHINE_MODES]; | |
282 char x_direct_store[NUM_MACHINE_MODES]; | |
283 | |
284 /* Record for each mode whether we can float-extend from memory. */ | |
285 bool x_float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES]; | |
286 }; | |
287 | |
288 extern struct target_regs default_target_regs; | |
289 #if SWITCHABLE_TARGET | |
290 extern struct target_regs *this_target_regs; | |
291 #else | |
292 #define this_target_regs (&default_target_regs) | |
293 #endif | |
294 | |
295 #define hard_regno_nregs \ | |
296 (this_target_regs->x_hard_regno_nregs) | |
297 #define reg_raw_mode \ | |
298 (this_target_regs->x_reg_raw_mode) | |
299 #define have_regs_of_mode \ | |
300 (this_target_regs->x_have_regs_of_mode) | |
301 #define contains_reg_of_mode \ | |
302 (this_target_regs->x_contains_reg_of_mode) | |
303 #define move_cost \ | |
304 (this_target_regs->x_move_cost) | |
305 #define may_move_in_cost \ | |
306 (this_target_regs->x_may_move_in_cost) | |
307 #define may_move_out_cost \ | |
308 (this_target_regs->x_may_move_out_cost) | |
309 #define direct_load \ | |
310 (this_target_regs->x_direct_load) | |
311 #define direct_store \ | |
312 (this_target_regs->x_direct_store) | |
313 #define float_extend_from_mem \ | |
314 (this_target_regs->x_float_extend_from_mem) | |
280 | 315 |
281 /* Return an exclusive upper bound on the registers occupied by hard | 316 /* Return an exclusive upper bound on the registers occupied by hard |
282 register (reg:MODE REGNO). */ | 317 register (reg:MODE REGNO). */ |
283 | 318 |
284 static inline unsigned int | 319 static inline unsigned int |