1 Changes for GCC version 2.95.1 for GNU Pascal 2.1
3 Before applying these diffs, go to the directory gcc-2.95.1
8 feeding it the following diffs as input.
10 *** gcc-2.95.1/gcc/expr.c.orig Thu Jul 1 00:59:55 1999
11 --- gcc-2.95.1/gcc/expr.c Sun Oct 24 14:01:38 1999
12 *************** store_constructor (exp, target, cleared)
16 domain_min = convert (sizetype, TYPE_MIN_VALUE (domain));
17 domain_max = convert (sizetype, TYPE_MAX_VALUE (domain));
20 + /* Align the set. */
22 + domain_min = size_binop (MINUS_EXPR, domain_min,
23 + size_binop (TRUNC_MOD_EXPR, domain_min,
24 + size_int (set_alignment)));
27 bitlength = size_binop (PLUS_EXPR,
28 size_binop (MINUS_EXPR, domain_max, domain_min),
30 *************** store_constructor (exp, target, cleared)
33 if (GET_MODE (target) != BLKmode || nbits <= 2 * BITS_PER_WORD
34 || (nbytes <= 32 && TREE_CHAIN (elt) != NULL_TREE))
37 int set_word_size = TYPE_ALIGN (TREE_TYPE (exp));
38 + #endif /* not GPC */
39 enum machine_mode mode = mode_for_size (set_word_size, MODE_INT, 1);
40 char *bit_buffer = (char *) alloca (nbits);
41 HOST_WIDE_INT word = 0;
42 *************** store_constructor (exp, target, cleared)
49 + if (set_words_big_endian)
52 + #endif /* not GPC */
53 word |= (1 << (set_word_size - 1 - bit_pos));
56 *************** store_constructor (exp, target, cleared)
63 + /* The language-specific run time library must provide
64 + a suitable `__setbits()' function whose action coincides
65 + with the values of `set_word_size', `set_alignment', and
66 + `set_words_big_endian'. */
68 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__setbits"),
69 0, VOIDmode, 4, XEXP (targetx, 0), Pmode,
70 bitlength_rtx, TYPE_MODE (sizetype),
71 *** gcc-2.95.1/gcc/stor-layout.c.orig Thu Mar 11 14:56:20 1999
72 --- gcc-2.95.1/gcc/stor-layout.c Wed Oct 27 16:39:10 1999
73 *************** int maximum_field_alignment;
76 May be overridden by front-ends. */
77 int set_alignment = 0;
80 + /* The word size of a bitstring or (power-)set value, in bits.
82 + May be overridden by front-ends. */
83 + int set_word_size = BITS_PER_UNIT;
85 + /* If non-zero, bits in (power-)sets start with the highest bit.
86 + May be overridden by front-ends. */
87 + int set_words_big_endian /*= BYTES_BIG_ENDIAN*/; /* @@@ Needn't be a constant! */
90 static tree layout_record PROTO((tree));
91 static void layout_union PROTO((tree));
93 *************** static tree pending_sizes;
97 int immediate_size_expand;
100 + /* Nonzero means that the size of a type may vary
101 + within one function context. */
103 + int size_volatile = 0;
109 *************** variable_size (size)
112 || global_bindings_p () < 0 || contains_placeholder_p (size))
116 + if (! size_volatile)
117 + size = save_expr (size);
118 + #else /* not GPC */
119 size = save_expr (size);
122 if (global_bindings_p ())
124 *************** variable_size (size)
127 Also, we would like to pass const0_rtx here, but don't have it. */
128 expand_expr (size, expand_expr (integer_zero_node, NULL_PTR, VOIDmode, 0),
131 + else if (! size_volatile)
132 + #else /* not GPC */
135 pending_sizes = tree_cons (NULL_TREE, size, pending_sizes);
138 *************** layout_type (type)
145 + int alignment = set_alignment ? set_alignment : set_word_size;
146 + int lower_bound = TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type)));
147 + int upper_bound = TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
148 + int size_in_bits, rounded_size;
150 + size_in_bits = upper_bound - (lower_bound / alignment) * alignment + 1;
153 + = (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
154 + - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1);
156 + = ((size_in_bits + alignment - 1) / alignment) * alignment;
157 + #else /* not GPC */
158 #ifndef SET_WORD_SIZE
159 #define SET_WORD_SIZE BITS_PER_WORD
161 *************** layout_type (type)
164 - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1);
166 = ((size_in_bits + alignment - 1) / alignment) * alignment;
167 + #endif /* not GPC */
168 if (rounded_size > alignment)
169 TYPE_MODE (type) = BLKmode;
171 *** gcc-2.95.1/gcc/tree.c.orig Wed Sep 29 19:41:05 1999
172 --- gcc-2.95.1/gcc/tree.c Tue Oct 19 00:04:25 1999
173 *************** get_set_constructor_bits (init, buffer,
176 HOST_WIDE_INT domain_min
177 = TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (init))));
178 tree non_const_bits = NULL_TREE;
181 + /* Align the set. */
183 + domain_min -= domain_min % set_alignment;
186 for (i = 0; i < bit_size; i++)
189 *************** get_set_constructor_bytes (init, buffer,
196 + int bit_size = wd_size * BITS_PER_UNIT;
197 + #else /* not GPC */
198 int set_word_size = BITS_PER_UNIT;
199 int bit_size = wd_size * set_word_size;
200 + #endif /* not GPC */
202 unsigned char *bytep = buffer;
203 char *bit_buffer = (char *) alloca(bit_size);
204 *************** get_set_constructor_bytes (init, buffer,
208 for (i = 0; i < bit_size; i++)
213 + int k = bit_pos / BITS_PER_UNIT;
214 + if (WORDS_BIG_ENDIAN)
215 + k = set_word_size / BITS_PER_UNIT - 1 - k;
216 + if (set_words_big_endian)
217 + bytep[k] |= (1 << (BITS_PER_UNIT - 1 - bit_pos % BITS_PER_UNIT));
219 + bytep[k] |= 1 << (bit_pos % BITS_PER_UNIT);
222 + if (bit_pos >= set_word_size)
225 + bytep += set_word_size / BITS_PER_UNIT;
227 + #else /* not GPC */
230 if (BYTES_BIG_ENDIAN)
231 *************** get_set_constructor_bytes (init, buffer,
235 if (bit_pos >= set_word_size)
236 bit_pos = 0, bytep++;
237 + #endif /* not GPC */
239 return non_const_bits;
241 *** gcc-2.95.1/gcc/tree.h.orig Mon Oct 18 12:19:46 1999
242 --- gcc-2.95.1/gcc/tree.h Mon Oct 18 12:36:04 1999
243 *************** extern int maximum_field_alignment;
246 /* If non-zero, the alignment of a bitstring or (power-)set value, in bits. */
247 extern int set_alignment;
250 + /* The word size of a bitstring or (power-)set value, in bits. */
251 + extern int set_word_size;
253 + /* If non-zero, bits in (power-)sets start with the highest bit. */
254 + extern int set_words_big_endian;
257 /* Concatenate two lists (chains of TREE_LIST nodes) X and Y
258 by making the last node in X point to Y.
259 Returns X, except if X is 0 returns Y. */
260 *** gcc-2.95.1/gcc/tree.def.orig Mon May 17 09:21:12 1999
261 --- gcc-2.95.1/gcc/tree.def Tue Oct 26 04:16:43 1999
262 *************** DEFTREECODE (WITH_CLEANUP_EXPR, "with_cl
264 DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
266 /* The following two codes are used in languages that have types where
267 ! the position and/or sizes of fields vary from object to object of the
268 ! same type, i.e., where some other field in the object contains a value
269 ! that is used in the computation of another field's offset or size.
271 ! For example, a record type with a discriminant in Ada is such a type.
272 ! This mechanism is also used to create "fat pointers" for unconstrained
273 ! array types in Ada; the fat pointer is a structure one of whose fields is
274 ! a pointer to the actual array type and the other field is a pointer to a
275 ! template, which is a structure containing the bounds of the array. The
276 ! bounds in the type pointed to by the first field in the fat pointer refer
277 ! to the values in the template.
279 ! These "self-references" are doing using a PLACEHOLDER_EXPR. This is a
280 ! node that will later be replaced with the object being referenced. Its type
281 ! is that of the object and selects which object to use from a chain of
282 ! references (see below).
284 ! When we wish to evaluate a size or offset, we check it is contains a
285 ! placeholder. If it does, we construct a WITH_RECORD_EXPR that contains
286 ! both the expression we wish to evaluate and an expression within which the
287 ! object may be found. The latter expression is the object itself in
288 ! the simple case of an Ada record with discriminant, but it can be the
289 ! array in the case of an unconstrained array.
291 ! In the latter case, we need the fat pointer, because the bounds of the
292 ! array can only be accessed from it. However, we rely here on the fact that
293 ! the expression for the array contains the dereference of the fat pointer
294 ! that obtained the array pointer.
296 Accordingly, when looking for the object to substitute in place of
297 a PLACEHOLDER_EXPR, we look down the first operand of the expression
298 ! passed as the second operand to WITH_RECORD_EXPR until we find something
299 ! of the desired type or reach a constant. */
301 /* Denotes a record to later be supplied with a WITH_RECORD_EXPR when
302 evaluating this expression. The type of this expression is used to
304 DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
306 /* The following two codes are used in languages that have types where
307 ! some field in an object of the type contains a value that is used in
308 ! the computation of another field's offset or size and/or the size of
309 ! the type. The positions and/or sizes of fields can vary from object
310 ! to object of the same type or even for one and the same object within
313 ! Record types with discriminants in Ada or schema types in Pascal are
314 ! examples of such types. This mechanism is also used to create "fat
315 ! pointers" for unconstrained array types in Ada; the fat pointer is a
316 ! structure one of whose fields is a pointer to the actual array type
317 ! and the other field is a pointer to a template, which is a structure
318 ! containing the bounds of the array. The bounds in the type pointed
319 ! to by the first field in the fat pointer refer to the values in the
322 ! When you wish to construct such a type you need "self-references"
323 ! that allow you to reference the object having this type from the
324 ! TYPE node, i.e. without having a variable instantiating this type.
326 ! Such a "self-references" is done using a PLACEHOLDER_EXPR. This is
327 ! a node that will later be replaced with the object being referenced.
328 ! Its type is that of the object and selects which object to use from
329 ! a chain of references (see below). No other slots are used in the
332 ! For example, if your type FOO is a RECORD_TYPE with a field BAR,
333 ! and you need the value of <variable>.BAR to calculate TYPE_SIZE
334 ! (FOO), just substitute <variable> above with a PLACEHOLDER_EXPR
335 ! whose TREE_TYPE is FOO. Then construct your COMPONENT_REF with
336 ! the PLACEHOLDER_EXPR as the first operand (which has the correct
337 ! type). Later, when the size is needed in the program, the back-end
338 ! will find this PLACEHOLDER_EXPR and generate code to calculate the
339 ! actual size at run-time. In the following, we describe how this
340 ! calculation is done.
342 ! When we wish to evaluate a size or offset, we check whether it
343 ! contains a PLACEHOLDER_EXPR. If it does, we construct a
344 ! WITH_RECORD_EXPR that contains both the expression we wish to
345 ! evaluate and an expression within which the object may be found.
346 ! The latter expression is the object itself in the simple case of an
347 ! Ada record with discriminant, but it can be the array in the case of
348 ! an unconstrained array.
350 ! In the latter case, we need the fat pointer, because the bounds of
351 ! the array can only be accessed from it. However, we rely here on the
352 ! fact that the expression for the array contains the dereference of
353 ! the fat pointer that obtained the array pointer.
355 Accordingly, when looking for the object to substitute in place of
356 a PLACEHOLDER_EXPR, we look down the first operand of the expression
357 ! passed as the second operand to WITH_RECORD_EXPR until we find
358 ! something of the desired type or reach a constant. */
360 /* Denotes a record to later be supplied with a WITH_RECORD_EXPR when
361 evaluating this expression. The type of this expression is used to