gcc/
[official-gcc.git] / gcc / ipa-struct-reorg.h
blob6f4c5b83d75c85db76e5ad2329507b1ee233f46e
1 /* Struct-reorg optimization.
2 Copyright (C) 2002, 2003-2007 Free Software Foundation, Inc.
3 Contributed by Olga Golovanevsky <olga@il.ibm.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA. */
22 #ifndef IPA_STRUCT_REORG_H
23 #define IPA_STRUCT_REORG_H
25 /* This file contains data structures and interfaces required
26 for struct-reorg optimizations. */
28 /* An access site of the structure field.
29 We consider an access to be of the following form:
31 D.2166_21 = i.6_20 * 8;
32 D.2167_22 = (struct str_t *) D.2166_21;
33 D.2168_24 = D.2167_22 + p.5_23;
34 D.2169_25 = D.2168_24->b;
37 struct field_access_site
39 /* Statement in which the access site occurs. */
40 tree stmt; /* D.2169_25 = D.2168_24->b; */
41 tree comp_ref; /* D.2168_24->b */
42 tree field_decl; /* b */
43 tree ref; /* D.2168_24 */
44 tree num; /* i.6_20 */
45 tree offset; /* D2167_22 */
46 tree base; /* p.5_23 */
47 tree ref_def_stmt; /* D.2168_24 = D.2167_22 + p.5_23; */
48 tree cast_stmt; /* D.2167_22 = (struct str_t *) D.2166_21;
49 This statement is not always present. */
52 /* A non-field structure access site. */
53 struct access_site
55 /* A statement in which the access site occurs. */
56 tree stmt;
57 /* A list of structure variables in the access site. */
58 VEC (tree, heap) *vars;
61 /* A field of the structure. */
62 struct field_entry
64 /* A field index. */
65 int index;
66 /* Number of times the field is accessed (according to profiling). */
67 gcov_type count;
68 tree decl;
69 /* A type of a new structure this field belongs to. */
70 tree field_mapping;
71 htab_t acc_sites;
74 /* This structure represents a result of the structure peeling.
75 The original structure is decomposed into substructures, or clusters. */
76 struct field_cluster
78 /* A bitmap of field indices. The set bit indicates that the field
79 corresponding to it is a part of this cluster. */
80 sbitmap fields_in_cluster;
81 struct field_cluster *sibling;
84 /* An information about an individual structure type (RECORD_TYPE) required
85 by struct-reorg optimizations to perform a transformation. */
86 struct data_structure
89 /* A main variant of the structure type. */
90 tree decl;
92 /* Number of fields in the structure. */
93 int num_fields;
95 /* A structure access count collected through profiling. */
96 gcov_type count;
98 /* An array of the structure fields, indexed by field ID. */
99 struct field_entry *fields;
101 /* Non-field accesses of the structure. */
102 htab_t accs;
104 /* A data structure representing a reorganization decision. */
105 struct field_cluster *struct_clustering;
107 /* New types to replace an the original structure type. */
108 VEC(tree, heap) *new_types;
111 typedef struct data_structure * d_str;
113 #endif /* IPA_STRUCT_REORG_H */