1 /* This file contains definitions for the register renamer. 2 Copyright (C) 2011 3 Free Software Foundation, Inc. 4 5 This file is part of GCC. 6 7 GCC is free software; you can redistribute it and/or modify it under 8 the terms of the GNU General Public License as published by the Free 9 Software Foundation; either version 3, or (at your option) any later 10 version. 11 12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with GCC; see the file COPYING3. If not see 19 <http://www.gnu.org/licenses/>. */ 20 21 #ifndef GCC_REGRENAME_H 22 #define GCC_REGRENAME_H 23 24 /* We keep linked lists of DU_HEAD structures, each of which describes 25 a chain of occurrences of a reg. */ 26 struct du_head 27 { 28 /* The next chain. */ 29 struct du_head *next_chain; 30 /* The first and last elements of this chain. */ 31 struct du_chain *first, *last; 32 /* Describes the register being tracked. */ 33 unsigned regno; 34 int nregs; 35 36 /* A unique id to be used as an index into the conflicts bitmaps. */ 37 unsigned id; 38 /* A bitmap to record conflicts with other chains. */ 39 bitmap_head conflicts; 40 /* Conflicts with untracked hard registers. */ 41 HARD_REG_SET hard_conflicts; 42 43 /* Nonzero if the chain crosses a call. */ 44 unsigned int need_caller_save_reg:1; 45 /* Nonzero if the register is used in a way that prevents renaming, 46 such as the SET_DEST of a CALL_INSN or an asm operand that used 47 to be a hard register. */ 48 unsigned int cannot_rename:1; 49 }; 50 51 typedef struct du_head *du_head_p; 52 DEF_VEC_P (du_head_p); 53 DEF_VEC_ALLOC_P (du_head_p, heap); 54 55 /* This struct describes a single occurrence of a register. */ 56 struct du_chain 57 { 58 /* Links to the next occurrence of the register. */ 59 struct du_chain *next_use; 60 61 /* The insn where the register appears. */ 62 rtx insn; 63 /* The location inside the insn. */ 64 rtx *loc; 65 /* The register class required by the insn at this location. */ 66 ENUM_BITFIELD(reg_class) cl : 16; 67 }; 68 69 /* This struct describes data gathered during regrename_analyze about 70 a single operand of an insn. */ 71 typedef struct 72 { 73 /* The number of chains recorded for this operand. */ 74 int n_chains; 75 /* Holds either the chain for the operand itself, or for the registers in 76 a memory operand. */ 77 struct du_chain *chains[MAX_REGS_PER_ADDRESS]; 78 struct du_head *heads[MAX_REGS_PER_ADDRESS]; 79 } operand_rr_info; 80 81 /* A struct to hold a vector of operand_rr_info structures describing the 82 operands of an insn. */ 83 typedef struct 84 { 85 operand_rr_info *op_info; 86 } insn_rr_info; 87 88 DEF_VEC_O (insn_rr_info); 89 DEF_VEC_ALLOC_O (insn_rr_info, heap); 90 91 extern VEC(insn_rr_info, heap) *insn_rr; 92 93 extern void regrename_init (bool); 94 extern void regrename_finish (void); 95 extern void regrename_analyze (bitmap); 96 extern du_head_p regrename_chain_from_id (unsigned int); 97 extern int find_best_rename_reg (du_head_p, enum reg_class, HARD_REG_SET *, 98 int); 99 extern void regrename_do_replace (du_head_p, int); 100 101 #endif 102