1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
/* Subroutines needed by GCC output code on some machines. */
/* Compile this file with the Unix C compiler! */
#include "config.h"
/* Define the C data type to use for an SImode value. */
#ifndef SItype
#define SItype long int
#endif
/* Define the type to be used for returning an SF mode value
and the method for turning a float into that type.
These definitions work for machines where an SF value is
returned in the same register as an int. */
#ifndef SFVALUE
#define SFVALUE int
#endif
#ifndef INTIFY
#define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
#endif
#ifdef GNULIB_NEEDS_DOUBLE
#define FLOAT_ARG_TYPE double
#define FLOATIFY(ARG) ((float) (ARG))
#endif
#ifndef FLOATIFY
#define FLOATIFY(INTVAL) ((INTVAL).f)
#endif
#ifndef FLOAT_ARG_TYPE
#define FLOAT_ARG_TYPE union flt_or_int
#endif
union flt_or_int { int i; float f; };
#ifdef L_eprintf
#include <stdio.h>
/* This is used by the `assert' macro. */
void
__eprintf (string, expression, line, filename)
char *string;
char *expression;
int line;
char *filename;
{
fprintf (stderr, string, expression, line, filename);
fflush (stderr);
abort ();
}
#endif
#ifdef L_umulsi3
SItype
__umulsi3 (a, b)
unsigned SItype a, b;
{
return a * b;
}
#endif
#ifdef L_mulsi3
SItype
__mulsi3 (a, b)
SItype a, b;
{
return a * b;
}
#endif
#ifdef L_udivsi3
SItype
__udivsi3 (a, b)
unsigned SItype a, b;
{
return a / b;
}
#endif
#ifdef L_divsi3
SItype
__divsi3 (a, b)
SItype a, b;
{
return a / b;
}
#endif
#ifdef L_umodsi3
SItype
__umodsi3 (a, b)
unsigned SItype a, b;
{
return a % b;
}
#endif
#ifdef L_modsi3
SItype
__modsi3 (a, b)
SItype a, b;
{
return a % b;
}
#endif
#ifdef L_lshrsi3
SItype
__lshrsi3 (a, b)
unsigned SItype a, b;
{
return a >> b;
}
#endif
#ifdef L_lshlsi3
SItype
__lshlsi3 (a, b)
unsigned SItype a, b;
{
return a << b;
}
#endif
#ifdef L_ashrsi3
SItype
__ashrsi3 (a, b)
SItype a, b;
{
return a >> b;
}
#endif
#ifdef L_ashlsi3
SItype
__ashlsi3 (a, b)
SItype a, b;
{
return a << b;
}
#endif
#ifdef L_divdf3
double
__divdf3 (a, b)
double a, b;
{
return a / b;
}
#endif
#ifdef L_muldf3
double
__muldf3 (a, b)
double a, b;
{
return a * b;
}
#endif
#ifdef L_negdf2
double
__negdf2 (a)
double a;
{
return -a;
}
#endif
#ifdef L_adddf3
double
__adddf3 (a, b)
double a, b;
{
return a + b;
}
#endif
#ifdef L_subdf3
double
__subdf3 (a, b)
double a, b;
{
return a - b;
}
#endif
#ifdef L_cmpdf2
SItype
__cmpdf2 (a, b)
double a, b;
{
if (a > b)
return 1;
else if (a < b)
return -1;
return 0;
}
#endif
#ifdef L_fixunsdfsi
#define HIGH_BIT_INT_COEFF (1 << (BITS_PER_WORD - 1))
#define HIGH_BIT_COEFF (2 * (double) (1 << (BITS_PER_WORD - 2)))
SItype
__fixunsdfsi (a)
double a;
{
if (a < HIGH_BIT_COEFF)
return (SItype)a;
/* Convert large positive numbers to smaller ones,
then increase again after you have a fixed point number. */
else
return ((SItype) (a - HIGH_BIT_COEFF)) + HIGH_BIT_INT_COEFF;
}
#endif
#ifdef L_fixdfsi
SItype
__fixdfsi (a)
double a;
{
return (SItype) a;
}
#endif
#ifdef L_floatsidf
double
__floatsidf (a)
SItype a;
{
return (double) a;
}
#endif
#ifdef L_addsf3
SFVALUE
__addsf3 (a, b)
FLOAT_ARG_TYPE a, b;
{
union flt_or_int intify;
return INTIFY (FLOATIFY (a) + FLOATIFY (b));
}
#endif
#ifdef L_negsf2
SFVALUE
__negsf2 (a)
FLOAT_ARG_TYPE a;
{
union flt_or_int intify;
return INTIFY (-FLOATIFY (a));
}
#endif
#ifdef L_subsf3
SFVALUE
__subsf3 (a, b)
FLOAT_ARG_TYPE a, b;
{
union flt_or_int intify;
return INTIFY (FLOATIFY (a) - FLOATIFY (b));
}
#endif
#ifdef L_cmpsf2
SItype
__cmpsf2 (a, b)
FLOAT_ARG_TYPE a, b;
{
if (FLOATIFY (a) > FLOATIFY (b))
return 1;
else if (FLOATIFY (a) < FLOATIFY (b))
return -1;
return 0;
}
#endif
#ifdef L_mulsf3
SFVALUE
__mulsf3 (a, b)
FLOAT_ARG_TYPE a, b;
{
union flt_or_int intify;
return INTIFY (FLOATIFY (a) * FLOATIFY (b));
}
#endif
#ifdef L_divsf3
SFVALUE
__divsf3 (a, b)
FLOAT_ARG_TYPE a, b;
{
union flt_or_int intify;
return INTIFY (FLOATIFY (a) / FLOATIFY (b));
}
#endif
#ifdef L_truncdfsf2
SFVALUE
__truncdfsf2 (a)
double a;
{
union flt_or_int intify;
return INTIFY (a);
}
#endif
#ifdef L_extendsfdf2
double
__extendsfdf2 (a)
FLOAT_ARG_TYPE a;
{
return FLOATIFY (a);
}
#endif
#ifdef L_bb
int __avoid_ranlib_warning; /* Don't let symbol table be empty. */
#if defined (sun) && defined (mc68000)
struct bb
{
int initialized;
char *filename;
int *counts;
int ncounts;
int zero_word;
int *addresses;
};
__bb_init_func (blocks)
struct bb *blocks;
{
extern int ___tcov_init;
if (! ___tcov_init)
___tcov_init_func ();
___bb_link (blocks->filename, blocks->counts, blocks->ncounts);
}
#endif
#endif
/* frills for C++ */
#ifdef L_builtin_new
typedef void (*vfp)();
extern vfp __new_handler;
char *
__builtin_new (sz)
long sz;
{
char *p;
p = (char *)malloc (sz);
if (p == 0)
(*__new_handler) ();
return p;
}
#endif
#ifdef L_builtin_New
typedef void (*vfp)();
static void
default_new_handler ();
vfp __new_handler = default_new_handler;
char *
__builtin_vec_new (p, maxindex, size, ctor)
char *p;
int maxindex, size;
void (*ctor)();
{
int i, nelts = maxindex + 1;
char *rval;
if (p == 0)
p = (char *)__builtin_new (nelts * size);
rval = p;
for (i = 0; i < nelts; i++)
{
(*ctor) (p);
p += size;
}
return rval;
}
vfp
__set_new_handler (handler)
vfp handler;
{
vfp prev_handler;
prev_handler = __new_handler;
if (handler == 0) handler = default_new_handler;
__new_handler = handler;
return prev_handler;
}
vfp
set_new_handler (handler)
vfp handler;
{
return __set_new_handler (handler);
}
static void
default_new_handler ()
{
/* don't use fprintf (stderr, ...) because it may need to call malloc. */
write (2, "default_new_handler: out of memory... aaaiiiiiieeeeeeeeeeeeee!\n", 65);
/* don't call exit () because that may call global destructors which
may cause a loop. */
_exit (-1);
}
#endif
#ifdef L_builtin_del
typedef void (*vfp)();
void
__builtin_delete (ptr)
char *ptr;
{
if (ptr)
free (ptr);
}
void
__builtin_vec_delete (ptr, maxindex, size, dtor, auto_delete_vec, auto_delete)
char *ptr;
int maxindex, size;
void (*dtor)();
int auto_delete;
{
int i, nelts = maxindex + 1;
char *p = ptr;
ptr += nelts * size;
for (i = 0; i < nelts; i++)
{
ptr -= size;
(*dtor) (ptr, auto_delete);
}
if (auto_delete_vec)
free (p);
}
#endif
|