| 1 |
280 |
jeremybenn |
/* Struct-reorg optimization.
|
| 2 |
|
|
Copyright (C) 2002, 2003-2007, 2008, 2009 Free Software Foundation, Inc.
|
| 3 |
|
|
Contributed by Olga Golovanevsky <olga@il.ibm.com>
|
| 4 |
|
|
|
| 5 |
|
|
This file is part of GCC.
|
| 6 |
|
|
|
| 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.
|
| 11 |
|
|
|
| 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.
|
| 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 IPA_STRUCT_REORG_H
|
| 22 |
|
|
#define IPA_STRUCT_REORG_H
|
| 23 |
|
|
|
| 24 |
|
|
/* This file contains data structures and interfaces required
|
| 25 |
|
|
for struct-reorg optimizations. */
|
| 26 |
|
|
|
| 27 |
|
|
/* An access site of the structure field.
|
| 28 |
|
|
We consider an access to be of the following form:
|
| 29 |
|
|
|
| 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;
|
| 34 |
|
|
*/
|
| 35 |
|
|
|
| 36 |
|
|
struct field_access_site
|
| 37 |
|
|
{
|
| 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. */
|
| 49 |
|
|
};
|
| 50 |
|
|
|
| 51 |
|
|
/* A non-field structure access site. */
|
| 52 |
|
|
struct access_site
|
| 53 |
|
|
{
|
| 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;
|
| 58 |
|
|
};
|
| 59 |
|
|
|
| 60 |
|
|
/* A field of the structure. */
|
| 61 |
|
|
struct field_entry
|
| 62 |
|
|
{
|
| 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;
|
| 71 |
|
|
};
|
| 72 |
|
|
|
| 73 |
|
|
/* This structure represents a result of the structure peeling.
|
| 74 |
|
|
The original structure is decomposed into substructures, or clusters. */
|
| 75 |
|
|
struct field_cluster
|
| 76 |
|
|
{
|
| 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;
|
| 81 |
|
|
};
|
| 82 |
|
|
|
| 83 |
|
|
/* An information about an individual structure type (RECORD_TYPE) required
|
| 84 |
|
|
by struct-reorg optimizations to perform a transformation. */
|
| 85 |
|
|
struct data_structure
|
| 86 |
|
|
{
|
| 87 |
|
|
|
| 88 |
|
|
/* A main variant of the structure type. */
|
| 89 |
|
|
tree decl;
|
| 90 |
|
|
|
| 91 |
|
|
/* Number of fields in the structure. */
|
| 92 |
|
|
int num_fields;
|
| 93 |
|
|
|
| 94 |
|
|
/* A structure access count collected through profiling. */
|
| 95 |
|
|
gcov_type count;
|
| 96 |
|
|
|
| 97 |
|
|
/* An array of the structure fields, indexed by field ID. */
|
| 98 |
|
|
struct field_entry *fields;
|
| 99 |
|
|
|
| 100 |
|
|
/* Non-field accesses of the structure. */
|
| 101 |
|
|
htab_t accs;
|
| 102 |
|
|
|
| 103 |
|
|
/* A data structure representing a reorganization decision. */
|
| 104 |
|
|
struct field_cluster *struct_clustering;
|
| 105 |
|
|
|
| 106 |
|
|
/* New types to replace the original structure type. */
|
| 107 |
|
|
VEC(tree, heap) *new_types;
|
| 108 |
|
|
};
|
| 109 |
|
|
|
| 110 |
|
|
typedef struct data_structure * d_str;
|
| 111 |
|
|
|
| 112 |
|
|
#endif /* IPA_STRUCT_REORG_H */
|