2009-04-16 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / ipa-struct-reorg.h
blob20176f268c7b8b2363bffa939d7e1f51f6adbba3
1 /* Struct-reorg optimization.
2 Copyright (C) 2002, 2003-2007, 2008, 2009 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 3 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; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef IPA_STRUCT_REORG_H
22 #define IPA_STRUCT_REORG_H
24 /* This file contains data structures and interfaces required
25 for struct-reorg optimizations. */
27 /* An access site of the structure field.
28 We consider an access to be of the following form:
30 D.2166_21 = i.6_20 * 8;
31 D.2167_22 = (struct str_t *) D.2166_21;
32 D.2168_24 = D.2167_22 + p.5_23;
33 D.2169_25 = D.2168_24->b;
36 struct field_access_site
38 /* Statement in which the access site occurs. */
39 gimple stmt; /* D.2169_25 = D.2168_24->b; */
40 tree comp_ref; /* D.2168_24->b */
41 tree field_decl; /* b */
42 tree ref; /* D.2168_24 */
43 tree num; /* i.6_20 */
44 tree offset; /* D2167_22 */
45 tree base; /* p.5_23 */
46 gimple ref_def_stmt; /* D.2168_24 = D.2167_22 + p.5_23; */
47 gimple cast_stmt; /* D.2167_22 = (struct str_t *) D.2166_21;
48 This statement is not always present. */
51 /* A non-field structure access site. */
52 struct access_site
54 /* A statement in which the access site occurs. */
55 gimple stmt;
56 /* A list of structure variables in the access site. */
57 VEC (tree, heap) *vars;
60 /* A field of the structure. */
61 struct field_entry
63 /* A field index. */
64 int index;
65 /* Number of times the field is accessed (according to profiling). */
66 gcov_type count;
67 tree decl;
68 /* A type of a new structure this field belongs to. */
69 tree field_mapping;
70 htab_t acc_sites;
73 /* This structure represents a result of the structure peeling.
74 The original structure is decomposed into substructures, or clusters. */
75 struct field_cluster
77 /* A bitmap of field indices. The set bit indicates that the field
78 corresponding to it is a part of this cluster. */
79 sbitmap fields_in_cluster;
80 struct field_cluster *sibling;
83 /* An information about an individual structure type (RECORD_TYPE) required
84 by struct-reorg optimizations to perform a transformation. */
85 struct data_structure
88 /* A main variant of the structure type. */
89 tree decl;
91 /* Number of fields in the structure. */
92 int num_fields;
94 /* A structure access count collected through profiling. */
95 gcov_type count;
97 /* An array of the structure fields, indexed by field ID. */
98 struct field_entry *fields;
100 /* Non-field accesses of the structure. */
101 htab_t accs;
103 /* A data structure representing a reorganization decision. */
104 struct field_cluster *struct_clustering;
106 /* New types to replace the original structure type. */
107 VEC(tree, heap) *new_types;
110 typedef struct data_structure * d_str;
112 #endif /* IPA_STRUCT_REORG_H */