]> git.pld-linux.org Git - packages/crossmingw32-gcc.git/blame - gcc-gpc.patch
- rel 4
[packages/crossmingw32-gcc.git] / gcc-gpc.patch
CommitLineData
53b567d6 1Changes for GCC version 2.95.1 for GNU Pascal 2.1
2
3Before applying these diffs, go to the directory gcc-2.95.1
4and use the command
5
6 patch -p1
7
8feeding it the following diffs as input.
9
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)
13*** 4430,4435 ****
14--- 4430,4444 ----
15
16 domain_min = convert (sizetype, TYPE_MIN_VALUE (domain));
17 domain_max = convert (sizetype, TYPE_MAX_VALUE (domain));
18+
19+ #ifdef GPC
20+ /* Align the set. */
21+ if (set_alignment)
22+ domain_min = size_binop (MINUS_EXPR, domain_min,
23+ size_binop (TRUNC_MOD_EXPR, domain_min,
24+ size_int (set_alignment)));
25+ #endif /* GPC */
26+
27 bitlength = size_binop (PLUS_EXPR,
28 size_binop (MINUS_EXPR, domain_max, domain_min),
29 size_one_node);
30*************** store_constructor (exp, target, cleared)
31*** 4444,4450 ****
32--- 4453,4461 ----
33 if (GET_MODE (target) != BLKmode || nbits <= 2 * BITS_PER_WORD
34 || (nbytes <= 32 && TREE_CHAIN (elt) != NULL_TREE))
35 {
36+ #ifndef GPC
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)
43*** 4456,4462 ****
44--- 4467,4477 ----
45 {
46 if (bit_buffer[ibit])
47 {
48+ #ifdef GPC
49+ if (set_words_big_endian)
50+ #else /* not GPC */
51 if (BYTES_BIG_ENDIAN)
52+ #endif /* not GPC */
53 word |= (1 << (set_word_size - 1 - bit_pos));
54 else
55 word |= 1 << bit_pos;
56*************** store_constructor (exp, target, cleared)
57*** 4570,4575 ****
58--- 4585,4596 ----
59 else
60 #endif
61 {
62+ #ifdef GPC
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'. */
67+ #endif /* GPC */
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;
74*** 53,58 ****
75--- 53,69 ----
76 May be overridden by front-ends. */
77 int set_alignment = 0;
78
79+ #ifdef GPC
80+ /* The word size of a bitstring or (power-)set value, in bits.
81+ Must be non-zero.
82+ May be overridden by front-ends. */
83+ int set_word_size = BITS_PER_UNIT;
84+
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! */
88+ #endif /* GPC */
89+
90 static tree layout_record PROTO((tree));
91 static void layout_union PROTO((tree));
92 \f
93*************** static tree pending_sizes;
94*** 65,70 ****
95--- 76,88 ----
96
97 int immediate_size_expand;
98
99+ #ifdef GPC
100+ /* Nonzero means that the size of a type may vary
101+ within one function context. */
102+
103+ int size_volatile = 0;
104+ #endif /* GPC */
105+
106 tree
107 get_pending_sizes ()
108 {
109*************** variable_size (size)
110*** 102,108 ****
111--- 120,131 ----
112 || global_bindings_p () < 0 || contains_placeholder_p (size))
113 return size;
114
115+ #ifdef GPC
116+ if (! size_volatile)
117+ size = save_expr (size);
118+ #else /* not GPC */
119 size = save_expr (size);
120+ #endif
121
122 if (global_bindings_p ())
123 {
124*************** variable_size (size)
125*** 119,125 ****
126--- 142,152 ----
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),
129 VOIDmode, 0);
130+ #ifdef GPC
131+ else if (! size_volatile)
132+ #else /* not GPC */
133 else
134+ #endif
135 pending_sizes = tree_cons (NULL_TREE, size, pending_sizes);
136
137 return size;
138*************** layout_type (type)
139*** 1040,1045 ****
140--- 1067,1086 ----
141 abort();
142 else
143 {
144+ #ifdef GPC
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;
149+ if (set_alignment)
150+ size_in_bits = upper_bound - (lower_bound / alignment) * alignment + 1;
151+ else
152+ size_in_bits
153+ = (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
154+ - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1);
155+ rounded_size
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
160 #endif
161*************** layout_type (type)
162*** 1049,1054 ****
163--- 1090,1096 ----
164 - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1);
165 int rounded_size
166 = ((size_in_bits + alignment - 1) / alignment) * alignment;
167+ #endif /* not GPC */
168 if (rounded_size > alignment)
169 TYPE_MODE (type) = BLKmode;
170 else
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,
174*** 4986,4991 ****
175--- 4986,4998 ----
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;
179+
180+ #ifdef GPC
181+ /* Align the set. */
182+ if (set_alignment)
183+ domain_min -= domain_min % set_alignment;
184+ #endif /* GPC */
185+
186 for (i = 0; i < bit_size; i++)
187 buffer[i] = 0;
188
189*************** get_set_constructor_bytes (init, buffer,
190*** 5038,5045 ****
191--- 5045,5056 ----
192 int wd_size;
193 {
194 int i;
195+ #ifdef GPC
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 */
201 int bit_pos = 0;
202 unsigned char *bytep = buffer;
203 char *bit_buffer = (char *) alloca(bit_size);
204*************** get_set_constructor_bytes (init, buffer,
205*** 5050,5055 ****
206--- 5061,5084 ----
207
208 for (i = 0; i < bit_size; i++)
209 {
210+ #ifdef GPC
211+ if (bit_buffer[i])
212+ {
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));
218+ else
219+ bytep[k] |= 1 << (bit_pos % BITS_PER_UNIT);
220+ }
221+ bit_pos++;
222+ if (bit_pos >= set_word_size)
223+ {
224+ bit_pos = 0;
225+ bytep += set_word_size / BITS_PER_UNIT;
226+ }
227+ #else /* not GPC */
228 if (bit_buffer[i])
229 {
230 if (BYTES_BIG_ENDIAN)
231*************** get_set_constructor_bytes (init, buffer,
232*** 5060,5065 ****
233--- 5089,5095 ----
234 bit_pos++;
235 if (bit_pos >= set_word_size)
236 bit_pos = 0, bytep++;
237+ #endif /* not GPC */
238 }
239 return non_const_bits;
240 }
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;
244*** 1630,1635 ****
245--- 1630,1643 ----
246 /* If non-zero, the alignment of a bitstring or (power-)set value, in bits. */
247 extern int set_alignment;
248
249+ #ifdef GPC
250+ /* The word size of a bitstring or (power-)set value, in bits. */
251+ extern int set_word_size;
252+
253+ /* If non-zero, bits in (power-)sets start with the highest bit. */
254+ extern int set_words_big_endian;
255+ #endif /* GPC */
256+
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
263*** 490,528 ****
264 DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
265
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.
270!
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.
278!
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).
283!
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.
290!
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.
295
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. */
300
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
303--- 490,547 ----
304 DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
305
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
311! its scope.
312!
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
320! template.
321!
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.
325!
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
330! PLACEHOLDER_EXPR.
331!
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.
341!
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.
349!
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.
354
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. */
359
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
This page took 0.06985 seconds and 4 git commands to generate.