/cp
[official-gcc.git] / gcc / stor-layout.h
blob74a2c6c4412700b09cf9c3738950178adc426cb8
1 /* Definitions and declarations for stor-layout.c.
2 Copyright (C) 2013-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_STOR_LAYOUT_H
21 #define GCC_STOR_LAYOUT_H
23 extern void set_min_and_max_values_for_integral_type (tree, int, bool);
24 extern void fixup_signed_type (tree);
25 extern void internal_reference_types (void);
26 extern unsigned int update_alignment_for_field (record_layout_info, tree,
27 unsigned int);
28 extern record_layout_info start_record_layout (tree);
29 extern tree bit_from_pos (tree, tree);
30 extern tree byte_from_pos (tree, tree);
31 extern void pos_from_bit (tree *, tree *, unsigned int, tree);
32 extern void normalize_offset (tree *, tree *, unsigned int);
33 extern tree rli_size_unit_so_far (record_layout_info);
34 extern tree rli_size_so_far (record_layout_info);
35 extern void normalize_rli (record_layout_info);
36 extern void place_field (record_layout_info, tree);
37 extern void compute_record_mode (tree);
38 extern void finish_record_layout (record_layout_info, int);
39 extern unsigned int element_precision (const_tree);
40 extern void finalize_size_functions (void);
41 extern void fixup_unsigned_type (tree);
42 extern void initialize_sizetypes (void);
44 /* Finish up a builtin RECORD_TYPE. Give it a name and provide its
45 fields. Optionally specify an alignment, and then lay it out. */
46 extern void finish_builtin_struct (tree, const char *, tree, tree);
48 /* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
49 calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
50 fields. Call this only once for any given decl node.
52 Second argument is the boundary that this field can be assumed to
53 be starting at (in bits). Zero means it can be assumed aligned
54 on any boundary that may be needed. */
55 extern void layout_decl (tree, unsigned);
57 /* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
58 TYPE_ALIGN and TYPE_MODE fields. If called more than once on one
59 node, does nothing except for the first time. */
60 extern void layout_type (tree);
62 /* Construct various nodes representing fract or accum data types. */
63 extern tree make_fract_type (int, int, int);
64 extern tree make_accum_type (int, int, int);
66 #define make_signed_fract_type(P) make_fract_type (P, 0, 0)
67 #define make_unsigned_fract_type(P) make_fract_type (P, 1, 0)
68 #define make_sat_signed_fract_type(P) make_fract_type (P, 0, 1)
69 #define make_sat_unsigned_fract_type(P) make_fract_type (P, 1, 1)
70 #define make_signed_accum_type(P) make_accum_type (P, 0, 0)
71 #define make_unsigned_accum_type(P) make_accum_type (P, 1, 0)
72 #define make_sat_signed_accum_type(P) make_accum_type (P, 0, 1)
73 #define make_sat_unsigned_accum_type(P) make_accum_type (P, 1, 1)
75 #define make_or_reuse_signed_fract_type(P) \
76 make_or_reuse_fract_type (P, 0, 0)
77 #define make_or_reuse_unsigned_fract_type(P) \
78 make_or_reuse_fract_type (P, 1, 0)
79 #define make_or_reuse_sat_signed_fract_type(P) \
80 make_or_reuse_fract_type (P, 0, 1)
81 #define make_or_reuse_sat_unsigned_fract_type(P) \
82 make_or_reuse_fract_type (P, 1, 1)
83 #define make_or_reuse_signed_accum_type(P) \
84 make_or_reuse_accum_type (P, 0, 0)
85 #define make_or_reuse_unsigned_accum_type(P) \
86 make_or_reuse_accum_type (P, 1, 0)
87 #define make_or_reuse_sat_signed_accum_type(P) \
88 make_or_reuse_accum_type (P, 0, 1)
89 #define make_or_reuse_sat_unsigned_accum_type(P) \
90 make_or_reuse_accum_type (P, 1, 1)
92 extern tree make_signed_type (int);
93 extern tree make_unsigned_type (int);
95 /* Return the mode for data of a given size SIZE and mode class CLASS.
96 If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
97 The value is BLKmode if no other mode is found. This is like
98 mode_for_size, but is passed a tree. */
99 extern enum machine_mode mode_for_size_tree (const_tree, enum mode_class, int);
101 /* Given a VAR_DECL, PARM_DECL or RESULT_DECL, clears the results of
102 a previous call to layout_decl and calls it again. */
103 extern void relayout_decl (tree);
105 /* variable_size (EXP) is like save_expr (EXP) except that it
106 is for the special case of something that is part of a
107 variable size for a data type. It makes special arrangements
108 to compute the value at the right time when the data type
109 belongs to a function parameter. */
110 extern tree variable_size (tree);
112 /* Vector types need to check target flags to determine type. */
113 extern enum machine_mode vector_type_mode (const_tree);
115 #endif // GCC_STOR_LAYOUT_H