properly mark symbols in the public API to be exported. This allows us to use -fvisib...
[libfirm] / include / libfirm / compound_path.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief Deprecated way to initialize compound entites! (use ir_initializer
23  *        stuff instead)
24  * Declarations for functions and datastructures to represent compound
25  * type initializers.
26  */
27 #ifndef FIRM_COMPOUND_PATHS_H
28 #define FIRM_COMPOUND_PATHS_H
29
30 #include "firm_types.h"
31 #include "begin.h"
32
33 typedef struct compound_graph_path  compound_graph_path, *ir_compound_graph_path_ptr;
34
35 /**
36  * @deprecated
37  * Creates a new compound graph path of given length.
38  */
39 FIRM_DLL compound_graph_path *new_compound_graph_path(ir_type *tp, int length);
40
41 /**
42  * @deprecated
43  * Returns non-zero if an object is a compound graph path
44  */
45 FIRM_DLL int is_compound_graph_path(const void *thing);
46
47 /**
48  * @deprecated
49  * Frees a graph path object
50  */
51 FIRM_DLL void free_compound_graph_path(compound_graph_path *gr);
52
53 /**
54  * @deprecated
55  * Returns the length of a graph path
56  */
57 FIRM_DLL int get_compound_graph_path_length(const compound_graph_path *gr);
58
59 /**
60  * @deprecated
61  * Get the entity node of an compound graph path at position pos.
62  */
63 ir_entity *get_compound_graph_path_node(const compound_graph_path *gr, int pos);
64
65 /**
66  * @deprecated
67  * Set the entity node of an compound graph path at position pos.
68  */
69 FIRM_DLL void set_compound_graph_path_node(compound_graph_path *gr, int pos,
70                                            ir_entity *node);
71
72 /**
73  * @deprecated
74  * Get the index of an compound graph path at position pos.
75  */
76 FIRM_DLL int get_compound_graph_path_array_index(const compound_graph_path *gr, int pos);
77
78 /**
79  * @deprecated
80  * Set the index of an compound graph path at position pos.
81  */
82 FIRM_DLL void set_compound_graph_path_array_index(compound_graph_path *gr, int pos, int index);
83
84 /**
85  * @deprecated
86  * Get the type of an compound graph path.
87  */
88 FIRM_DLL ir_type *get_compound_graph_path_type(const compound_graph_path *gr);
89
90 /**
91  * @deprecated
92  * Checks whether the path up to pos is correct. If the path contains a NULL,
93  *  assumes the path is not complete and returns non-zero.
94  */
95 FIRM_DLL int is_proper_compound_graph_path(compound_graph_path *gr, int pos);
96
97 /**
98  * @deprecated
99  * A value of a compound entity is a pair of a value and the description of the
100  * corresponding access path to the member of the compound.
101  */
102 FIRM_DLL void add_compound_ent_value_w_path(ir_entity *ent, ir_node *val, compound_graph_path *path);
103 FIRM_DLL void set_compound_ent_value_w_path(ir_entity *ent, ir_node *val, compound_graph_path *path, int pos);
104
105 /**
106  * @deprecated
107  * Returns the access path for value at position pos.
108  */
109 FIRM_DLL compound_graph_path *get_compound_ent_value_path(const ir_entity *ent, int pos);
110
111 /**
112  * @deprecated
113  * Returns a constant value given the access path.
114  *  The path must contain array indices for all array element entities.
115  */
116 FIRM_DLL ir_node *get_compound_ent_value_by_path(const ir_entity *ent,
117                                                  compound_graph_path *path);
118
119 /**
120  * @deprecated
121  * Removes all constant entries where the path ends at value_ent. Does not
122  * free the memory of the paths.  (The same path might be used for several
123  * constant entities.
124  */
125 FIRM_DLL void remove_compound_ent_value(ir_entity *ent, ir_entity *value_ent);
126
127 /**
128  * @deprecated
129  * Generates a Path with length 1.
130  *  Beware: Has a bad runtime for array elements (O(|array|) and should be
131  *  avoided there. Use add_compound_ent_value_w_path() instead and create
132  *  the path manually.
133  */
134 FIRM_DLL void add_compound_ent_value(ir_entity *ent, ir_node *val, ir_entity *member);
135
136 /**
137  * @deprecated
138  * Returns the last member in the path
139  */
140 FIRM_DLL ir_entity *get_compound_ent_value_member(const ir_entity *ent, int pos);
141
142 /**
143  * @deprecated
144  * Sets the path at pos 0
145  */
146 FIRM_DLL void set_compound_ent_value(ir_entity *ent, ir_node *val,
147                                      ir_entity *member, int pos);
148
149 /**
150  * @deprecated
151  * Initializes the entity ent which must be of a one dimensional
152  * array type with the values given in the values array.
153  * The array must have a lower and an upper bound.  Keeps the
154  * order of values. Does not test whether the number of values
155  * fits into the given array size.  Does not test whether the
156  * values have the proper mode for the array.
157  */
158 FIRM_DLL void set_array_entity_values(ir_entity *ent, tarval **values, int num_vals);
159
160 /**
161  * @deprecated
162  * Return the offset in bits from the last byte address.
163  *
164  * This requires that the layout of all concerned types is fixed.
165  *
166  * @param ent Any entity of compound type with at least pos initialization values.
167  * @param pos The position of the value for which the offset is requested.
168  */
169 FIRM_DLL unsigned get_compound_ent_value_offset_bit_remainder(const ir_entity *ent, int pos);
170
171 /**
172  * @deprecated
173  * Return the overall offset of value at position pos in bytes.
174  *
175  * This requires that the layout of all concerned types is fixed.
176  * Asserts if bit offset is not byte aligned.
177  *
178  * @param ent Any entity of compound type with at least pos initialization values.
179  * @param pos The position of the value for which the offset is requested.
180  */
181 FIRM_DLL unsigned get_compound_ent_value_offset_bytes(const ir_entity *ent, int pos);
182
183 /**
184  * @deprecated
185  * Returns the number of constant values needed to initialize the entity.
186  * Asserts if the entity has variability_uninitialized.
187  */
188 FIRM_DLL int get_compound_ent_n_values(const ir_entity *ent);
189
190 /**
191  * @deprecated
192  * Returns a constant value given the position.
193  */
194 FIRM_DLL ir_node *get_compound_ent_value(const ir_entity *ent, int pos);
195
196 /**
197  * @deprecated
198  * return 1 if entity has a compound_graph-style initializer
199  */
200 FIRM_DLL int entity_has_compound_ent_values(const ir_entity *entity);
201
202 #include "end.h"
203
204 #endif