irmode.c 16.1 KB
Newer Older
Christian Schäfer's avatar
Christian Schäfer committed
1
/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2
3
4
5
** All rights reserved.
**
** Authors: Martin Trapp, Christian Schaefer
**
Christian Schäfer's avatar
Christian Schäfer committed
6
7
*/

Boris Boesler's avatar
Boris Boesler committed
8
9
/* $Id$ */

Boris Boesler's avatar
added    
Boris Boesler committed
10
11
12
13
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

Götz Lindenmaier's avatar
Götz Lindenmaier committed
14
# include "irmode_t.h"
15
16
# include "ident.h"
# include <malloc.h>
Christian Schäfer's avatar
Christian Schäfer committed
17
# include <stddef.h>
18
# include <string.h>
Christian Schäfer's avatar
Christian Schäfer committed
19
# include "tv.h"
20
# include "array.h"
Christian Schäfer's avatar
Christian Schäfer committed
21

22
#if 0
Götz Lindenmaier's avatar
Götz Lindenmaier committed
23
static long long count = 0;
24
25
26
27
#  define ANNOUNCE() printf(__FILE__": call no. %lld (%s)\n", count++, __FUNCTION__)
#else
#  define ANNOUNCE() ((void)0)
#endif
Christian Schäfer's avatar
Christian Schäfer committed
28

29
30
31
/* * *
 * local values
 * * */
32

Christian Schäfer's avatar
Christian Schäfer committed
33

Michael Beck's avatar
Michael Beck committed
34
/** dynamic array to hold all modes */
35
36
37
38
39
40
static ir_mode * modes;
/* dynamic arrays to hold special modes' values */
static tarval** modes_min;
static tarval** modes_max;
static tarval** modes_null;
static tarval** modes_one;
Christian Schäfer's avatar
Christian Schäfer committed
41

Michael Beck's avatar
Michael Beck committed
42
/** number of defined modes */
43
static int num_modes;
Christian Schäfer's avatar
Christian Schäfer committed
44

45
46
47
/* * *
 * local functions
 * * */
Christian Schäfer's avatar
Christian Schäfer committed
48

49
50
51
52
/**
 * compare modes that don't need to have their code field
 * correctly set
 */
53
54
55
56
57
58
59
static int modes_are_equal(ir_mode *m, ir_mode *n)
{
  if (m == n) return 1;
  if ( (m->sort == n->sort) && (m->size == n->size) &&
      (m->align == n->align) && (m->sign == n->sign) &&
      (m->name == n->name) )
    return 1;
Christian Schäfer's avatar
Christian Schäfer committed
60

61
62
  return 0;
}
Matthias Heil's avatar
Matthias Heil committed
63

64
65
/**
 * searches the modes array for the given mode and returns
66
 * a pointer on an equal mode already in the array, NULL if
67
68
 * none found
 */
69
70
71
static ir_mode *find_mode(ir_mode *m)
{
  int i;
Matthias Heil's avatar
Matthias Heil committed
72

73
74
75
76
  for (i = 0; i < num_modes; i++)
  {
    if (modes_are_equal(m, &modes[i])) return &modes[i];
  }
Matthias Heil's avatar
Matthias Heil committed
77

78
79
  return NULL;
}
Christian Schäfer's avatar
Christian Schäfer committed
80

81
82
83
/**
 * sets special values of modes
 */
84
85
86
87
88
89
90
91
92
93
static void set_mode_values(ir_mode* mode)
{
  modes_min[get_mode_modecode(mode)] = get_tarval_min(mode);
  modes_max[get_mode_modecode(mode)] = get_tarval_max(mode);
  modes_null[get_mode_modecode(mode)] = get_tarval_null(mode);
  modes_one[get_mode_modecode(mode)] = get_tarval_one(mode);
}
/* * *
 * globals defined in irmode.h
 * * */
Matthias Heil's avatar
Matthias Heil committed
94

95
/* --- Predefined modes --- */
Christian Schäfer's avatar
Christian Schäfer committed
96

97
98
99
100
101
/* FIRM internal modes: */
ir_mode *mode_T;
ir_mode *mode_X;
ir_mode *mode_M;
ir_mode *mode_BB;
Christian Schäfer's avatar
Christian Schäfer committed
102

103
104
105
106
/* predefined numerical modes: */
ir_mode *mode_F;    /* float */
ir_mode *mode_D;    /* double */
ir_mode *mode_E;    /* long double */
Christian Schäfer's avatar
Christian Schäfer committed
107

108
109
110
111
112
113
114
115
ir_mode *mode_Bs;   /* integral values, signed and unsigned */
ir_mode *mode_Bu;   /* 8 bit */
ir_mode *mode_Hs;   /* 16 bit */
ir_mode *mode_Hu;
ir_mode *mode_Is;   /* 32 bit */
ir_mode *mode_Iu;
ir_mode *mode_Ls;   /* 64 bit */
ir_mode *mode_Lu;
Christian Schäfer's avatar
Christian Schäfer committed
116

117
118
119
120
ir_mode *mode_C;
ir_mode *mode_U;
ir_mode *mode_b;
ir_mode *mode_P;
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
/* * *
 * functions defined in irmode.h
 * * */

/* JNI access functions */
INLINE ir_mode *get_modeT() { ANNOUNCE(); return mode_T; }
INLINE ir_mode *get_modeF() { ANNOUNCE(); return mode_F; }
INLINE ir_mode *get_modeD() { ANNOUNCE(); return mode_D; }
INLINE ir_mode *get_modeE() { ANNOUNCE(); return mode_E; }
INLINE ir_mode *get_modeBs() { ANNOUNCE(); return mode_Bs; }
INLINE ir_mode *get_modeBu() { ANNOUNCE(); return mode_Bu; }
INLINE ir_mode *get_modeHs() { ANNOUNCE(); return mode_Hs; }
INLINE ir_mode *get_modeHu() { ANNOUNCE(); return mode_Hu; }
INLINE ir_mode *get_modeIs() { ANNOUNCE(); return mode_Is; }
INLINE ir_mode *get_modeIu() { ANNOUNCE(); return mode_Iu; }
INLINE ir_mode *get_modeLs() { ANNOUNCE(); return mode_Ls; }
INLINE ir_mode *get_modeLu() { ANNOUNCE(); return mode_Lu; }
INLINE ir_mode *get_modeC() { ANNOUNCE(); return mode_C; }
INLINE ir_mode *get_modeU() { ANNOUNCE(); return mode_U; }
INLINE ir_mode *get_modeb() { ANNOUNCE(); return mode_b; }
INLINE ir_mode *get_modeP() { ANNOUNCE(); return mode_P; }
INLINE ir_mode *get_modeX() { ANNOUNCE(); return mode_X; }
INLINE ir_mode *get_modeM() { ANNOUNCE(); return mode_M; }
INLINE ir_mode *get_modeBB() { ANNOUNCE(); return mode_BB; }

/* ** Constructor ** */
ir_mode *
Götz Lindenmaier's avatar
Götz Lindenmaier committed
149
register_mode(ir_mode* new_mode)
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
{
  ir_mode *mode;

  ANNOUNCE();
  assert(new_mode);

  /* first check if there already is a matching mode */
  mode = find_mode(new_mode);
  if (mode) return mode;

  /* sanity checks */
  switch (new_mode->sort)
  {
    case auxiliary:
    case internal_boolean:
      assert(0 && "internal modes cannot be user defined");
166
      return NULL;
167
168
169
170
      break;

    case float_number:
      assert(0 && "not yet implemented");
171
      return NULL;
172
173
174
175
176
177
178
179
180
      break;

    case int_number:
    case reference:
    case character:
      break;

    default:
      assert(0);
181
      return NULL;
182
  }
Christian Schäfer's avatar
Christian Schäfer committed
183

184
185
186
187
188
189
190
  /* copy mode struct to modes array */
  ARR_EXTEND(ir_mode, modes, 1);
  ARR_EXTEND(tarval*, modes_min, 1);
  ARR_EXTEND(tarval*, modes_max, 1);
  ARR_EXTEND(tarval*, modes_null, 1);
  ARR_EXTEND(tarval*, modes_one, 1);
  mode = &modes[num_modes];
Christian Schäfer's avatar
Christian Schäfer committed
191

192
193
194
195
196
  memcpy(mode, new_mode, sizeof(ir_mode));
  mode->code = num_modes;
  num_modes++;

  set_mode_values(mode);
Christian Schäfer's avatar
Christian Schäfer committed
197

198
  return mode;
Christian Schäfer's avatar
Christian Schäfer committed
199
200
}

201
/* Functions for the direct access to all attributes od a ir_mode */
Christian Schäfer's avatar
Christian Schäfer committed
202
modecode
203
get_mode_modecode(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
204
{
205
  ANNOUNCE();
Christian Schäfer's avatar
Christian Schäfer committed
206
207
208
209
  return mode->code;
}

ident *
210
get_mode_ident(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
211
{
212
  ANNOUNCE();
Christian Schäfer's avatar
Christian Schäfer committed
213
214
215
  return mode->name;
}

216
217
const char *
get_mode_name(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
218
{
219
220
  ANNOUNCE();
  return id_to_str(mode->name);
Christian Schäfer's avatar
Christian Schäfer committed
221
222
}

223
224
225
226
227
mode_sort
get_mode_sort(ir_mode* mode)
{
  ANNOUNCE();
  return mode->sort;
Götz Lindenmaier's avatar
Götz Lindenmaier committed
228
229
}

Götz Lindenmaier's avatar
Götz Lindenmaier committed
230
231
INLINE int
get_mode_size_bits(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
232
{
233
  ANNOUNCE();
Christian Schäfer's avatar
Christian Schäfer committed
234
235
236
  return mode->size;
}

Götz Lindenmaier's avatar
Götz Lindenmaier committed
237
238
239
240
241
242
243
int get_mode_size_bytes(ir_mode *mode) {
  ANNOUNCE();
  int size = get_mode_size_bits(mode);
  if ((size % 8) != 0) return -1;
  return size / 8;
}

Christian Schäfer's avatar
Christian Schäfer committed
244
int
245
get_mode_align (ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
246
{
247
248
  ANNOUNCE();
  return mode->align;
Christian Schäfer's avatar
Christian Schäfer committed
249
}
250
251
252
253
254
255
256
257

int
get_mode_sign (ir_mode *mode)
{
  ANNOUNCE();
  return mode->sign;
}

Christian Schäfer's avatar
Christian Schäfer committed
258
tarval *
Götz Lindenmaier's avatar
Götz Lindenmaier committed
259
get_mode_min (ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
260
{
261
262
263
264
  ANNOUNCE();
  assert(mode);
  assert(get_mode_modecode(mode) < num_modes);
  assert(mode_is_data(mode));
Christian Schäfer's avatar
Christian Schäfer committed
265

266
  return modes_min[get_mode_modecode(mode)];
Christian Schäfer's avatar
Christian Schäfer committed
267
268
269
}

tarval *
Götz Lindenmaier's avatar
Götz Lindenmaier committed
270
get_mode_max (ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
271
{
272
273
274
275
  ANNOUNCE();
  assert(mode);
  assert(get_mode_modecode(mode) < num_modes);
  assert(mode_is_data(mode));
Christian Schäfer's avatar
Christian Schäfer committed
276

277
  return modes_max[get_mode_modecode(mode)];
Christian Schäfer's avatar
Christian Schäfer committed
278
279
280
}

tarval *
Götz Lindenmaier's avatar
Götz Lindenmaier committed
281
get_mode_null (ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
282
{
283
284
285
286
  ANNOUNCE();
  assert(mode);
  assert(get_mode_modecode(mode) < num_modes);
  assert(mode_is_data(mode));
Christian Schäfer's avatar
Christian Schäfer committed
287

288
  return modes_null[get_mode_modecode(mode)];
Christian Schäfer's avatar
Christian Schäfer committed
289
290
}

291
292
tarval *
get_mode_one (ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
293
{
294
295
296
297
  ANNOUNCE();
  assert(mode);
  assert(get_mode_modecode(mode) < num_modes);
  assert(mode_is_data(mode));
Christian Schäfer's avatar
Christian Schäfer committed
298

299
  return modes_one[get_mode_modecode(mode)];
Christian Schäfer's avatar
Christian Schäfer committed
300
301
}

302
303
tarval *
get_mode_infinite(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
304
{
305
306
307
308
309
310
  ANNOUNCE();
  assert(mode);
  assert(get_mode_modecode(mode) < num_modes);
  assert(mode_is_float(mode));

  return get_tarval_inf(mode);
Christian Schäfer's avatar
Christian Schäfer committed
311
312
}

313
314
tarval *
get_mode_NAN(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
315
{
316
317
318
319
320
321
  ANNOUNCE();
  assert(mode);
  assert(get_mode_modecode(mode) < num_modes);
  assert(mode_is_float(mode));

  return get_tarval_nan(mode);
Christian Schäfer's avatar
Christian Schäfer committed
322
323
324
325
326
327
328
329
}

/* Functions to check, whether a modecode is signed, float, int, num, data,
   datab or dataM. For more exact definitions read the corresponding pages
   in the firm documentation or the followingenumeration

   The set of "float" is defined as:
   ---------------------------------
Matthias Heil's avatar
Matthias Heil committed
330
   float = {irm_F, irm_D, irm_E}
Christian Schäfer's avatar
Christian Schäfer committed
331
332
333

   The set of "int" is defined as:
   -------------------------------
Matthias Heil's avatar
Matthias Heil committed
334
   int   = {irm_Bs, irm_Bu, irm_Hs, irm_Hu, irm_Is, irm_Iu, irm_Ls, irm_Lu}
Christian Schäfer's avatar
Christian Schäfer committed
335
336
337

   The set of "num" is defined as:
   -------------------------------
Matthias Heil's avatar
Matthias Heil committed
338
339
   num   = {irm_F, irm_D, irm_E, irm_Bs, irm_Bu, irm_Hs, irm_Hu,
            irm_Is, irm_Iu, irm_Ls, irm_Lu}
Christian Schäfer's avatar
Christian Schäfer committed
340
341
342
343
            = {float || int}

   The set of "data" is defined as:
   -------------------------------
Matthias Heil's avatar
Matthias Heil committed
344
   data  = {irm_F, irm_D, irm_E irm_Bs, irm_Bu, irm_Hs, irm_Hu,
345
346
            irm_Is, irm_Iu, irm_Ls, irm_Lu, irm_C, irm_U, irm_P}
            = {num || irm_C || irm_U || irm_P}
Christian Schäfer's avatar
Christian Schäfer committed
347
348
349

   The set of "datab" is defined as:
   ---------------------------------
Matthias Heil's avatar
Matthias Heil committed
350
   datab = {irm_F, irm_D, irm_E, irm_Bs, irm_Bu, irm_Hs, irm_Hu,
351
            irm_Is, irm_Iu, irm_Ls, irm_Lu, irm_C, irm_U, irm_P, irm_b}
Matthias Heil's avatar
Matthias Heil committed
352
            = {data || irm_b }
Christian Schäfer's avatar
Christian Schäfer committed
353
354
355

   The set of "dataM" is defined as:
   ---------------------------------
Matthias Heil's avatar
Matthias Heil committed
356
   dataM = {irm_F, irm_D, irm_E, irm_Bs, irm_Bu, irm_Hs, irm_Hu,
357
            irm_Is, irm_Iu, irm_Ls, irm_Lu, irm_C, irm_U, irm_P, irm_M}
Christian Schäfer's avatar
Christian Schäfer committed
358
359
360
            = {data || irm_M}
*/

361
362
363
364
365
366
367
368
369
#ifdef MODE_ACCESS_DEFINES
#  undef mode_is_signed
#  undef mode_is_float
#  undef mode_is_int
#  undef mode_is_num
#  undef mode_is_data
#  undef mode_is_datab
#  undef mode_is_dataM
#endif
Christian Schäfer's avatar
Christian Schäfer committed
370
371
372
int
mode_is_signed (ir_mode *mode)
{
373
374
375
  ANNOUNCE();
  assert(mode);
  return mode->sign;
Christian Schäfer's avatar
Christian Schäfer committed
376
377
}

378
int
Christian Schäfer's avatar
Christian Schäfer committed
379
380
mode_is_float (ir_mode *mode)
{
381
382
383
  ANNOUNCE();
  assert(mode);
  return (get_mode_sort(mode) == float_number);
Christian Schäfer's avatar
Christian Schäfer committed
384
385
}

386
int
Christian Schäfer's avatar
Christian Schäfer committed
387
388
mode_is_int (ir_mode *mode)
{
389
390
391
  ANNOUNCE();
  assert(mode);
  return (get_mode_sort(mode) == int_number);
Christian Schäfer's avatar
Christian Schäfer committed
392
393
}

394
int
Christian Schäfer's avatar
Christian Schäfer committed
395
396
mode_is_num (ir_mode *mode)
{
397
398
399
  ANNOUNCE();
  assert(mode);
  return (mode_is_int(mode) || mode_is_float(mode));
Christian Schäfer's avatar
Christian Schäfer committed
400
401
}

402
int
Christian Schäfer's avatar
Christian Schäfer committed
403
404
mode_is_data (ir_mode *mode)
{
405
406
407
  ANNOUNCE();
  assert(mode);
  return (mode_is_num(mode) || get_mode_sort(mode) == character || get_mode_sort(mode) == reference);
Christian Schäfer's avatar
Christian Schäfer committed
408
409
410
411
412
}

int
mode_is_datab (ir_mode *mode)
{
413
414
415
  ANNOUNCE();
  assert(mode);
  return (mode_is_data(mode) || get_mode_sort(mode) == internal_boolean);
Christian Schäfer's avatar
Christian Schäfer committed
416
417
418
419
420
}

int
mode_is_dataM (ir_mode *mode)
{
421
422
423
  ANNOUNCE();
  assert(mode);
  return (mode_is_data(mode) || get_mode_modecode(mode) == irm_M);
Christian Schäfer's avatar
Christian Schäfer committed
424
}
425
426
427
428
429
430
431
432
433
#ifdef MODE_ACCESS_DEFINES
#  define mode_is_signed(mode) (mode)->sign
#  define mode_is_float(mode) ((mode)->sort == float_number)
#  define mode_is_int(mode) ((mode)->sort == int_number)
#  define mode_is_num(mode) (((mode)->sort == float_number) || ((mode)->sort == int_number))
#  define mode_is_data(mode) (((mode)->sort == float_number) || ((mode)->sort == int_number) || ((mode)->sort == character) || ((mode)->sort == reference))
#  define mode_is_datab(mode) (((mode)->sort == float_number) || ((mode)->sort == int_number) || ((mode)->sort == character) || ((mode)->sort == reference) || ((mode)->sort == internal_boolean))
#  define mode_is_dataM(mode) (((mode)->sort == float_number) || ((mode)->sort == int_number) || ((mode)->sort == character) || ((mode)->sort == reference) || ((mode)->code == irm_M))
#endif
434
/* Returns true if sm can be converted to lm without loss. */
435
int
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
smaller_mode(ir_mode *sm, ir_mode *lm)
{
  ANNOUNCE();
  assert(sm);
  assert(lm);

  if (sm == lm) return 1;

  switch(get_mode_sort(sm))
  {
    case int_number:
      switch(get_mode_sort(lm))
      {
        case int_number:
          /* integers are convertable if
           *   - both have the same sign and lm is the larger one
           *   - lm is the signed one and is at least two bits larger
           *     (one for the sign, one for the highest bit of sm)
           */
          if (mode_is_signed(sm))
          {
457
            if ( mode_is_signed(lm) && (get_mode_size_bits(lm) > get_mode_size_bits(sm)) )
458
459
460
461
              return 1;
          }
          else if (mode_is_signed(lm))
          {
462
            if (get_mode_size_bits(lm) > get_mode_size_bits(sm) + 1)
463
464
              return 1;
          }
465
          else if (get_mode_size_bits(lm) > get_mode_size_bits(sm))
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
          {
            return 1;
          }
          break;

        case float_number:
          /* int to float works if the float is large enough */
          return 0;

        default:
          break;
      }
      break;

    case float_number:
      /* XXX currently only the three standard 32,64,80 bit floats
       * are supported which can safely be converted */
      if ( (get_mode_sort(lm) == float_number)
484
           && (get_mode_size_bits(lm) > get_mode_size_bits(sm)) )
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
         return 1;
      break;

    case reference:
       /* do exist machines out there with different pointer lenghts ?*/
      return 0;

    default:
      break;
  }

  /* else */
  return 0;
}

500
/* ** initialization ** */
501
502
503
504
505
void
init_mode (void)
{
  ANNOUNCE();
  /* init flexible array */
506
507
508
  modes      = NEW_ARR_F(ir_mode, irm_max);
  modes_min  = NEW_ARR_F(tarval*, irm_max);
  modes_max  = NEW_ARR_F(tarval*, irm_max);
509
  modes_null = NEW_ARR_F(tarval*, irm_max);
510
  modes_one  = NEW_ARR_F(tarval*, irm_max);
511
512
513
514
515
516
517
518

  /* initialize predefined modes */
  /* Basic Block */
  mode_BB = &modes[irm_BB];
  mode_BB->name = id_from_str("BB", 2);
  mode_BB->code = irm_BB;
  mode_BB->sort = auxiliary;
  mode_BB->sign = 0;
519
  mode_BB->tv_priv = NULL;
520
521
522
523
524
525
526

  /* eXecution */
  mode_X = &modes[irm_X];
  mode_X->name = id_from_str("X", 1);
  mode_X->code = irm_X;
  mode_X->sort = auxiliary;
  mode_X->sign = 0;
527
  mode_X->tv_priv = NULL;
528
529
530
531
532
533
534

  /* Memory */
  mode_M = &modes[irm_M];
  mode_M->name = id_from_str("M", 1);
  mode_M->code = irm_M;
  mode_M->sort = auxiliary;
  mode_M->sign = 0;
535
  mode_M->tv_priv = NULL;
536
537
538
539
540
541

  /* Tuple */
  mode_T = &modes[irm_T];
  mode_T->name = id_from_str("T", 1);
  mode_T->code = irm_T;
  mode_T->sign = 0;
542
  mode_T->tv_priv = NULL;
543
544
545
546
547
548
549

  /* boolean */
  mode_b = &modes[irm_b];
  mode_b->name = id_from_str("b", 1);
  mode_b->code = irm_b;
  mode_b->sort = internal_boolean;
  mode_b->sign = 0;
550
  mode_b->tv_priv = NULL;
551
552
553
554
555
556
557
558
559

  /* float */
  mode_F = &modes[irm_F];
  mode_F->name = id_from_str("F", 1);
  mode_F->code = irm_F;
  mode_F->sort = float_number;
  mode_F->sign = 1;
  mode_F->align = 32;
  mode_F->size = 32;
560
  mode_F->tv_priv = NULL;
561
562
563
564
565
566
567
568
569
570
571

  set_mode_values(mode_F);

  /* double */
  mode_D = &modes[irm_D];
  mode_D->name = id_from_str("D", 1);
  mode_D->code = irm_D;
  mode_D->sort = float_number;
  mode_D->sign = 1;
  mode_D->align = 32;
  mode_D->size = 64;
572
  mode_D->tv_priv = NULL;
573
574
575
576
577
578
579
580
581
582
583

  set_mode_values(mode_D);

  /* extended */
  mode_E = &modes[irm_E];
  mode_E->name = id_from_str("E", 1);
  mode_E->code = irm_E;
  mode_E->sort = float_number;
  mode_E->sign = 1;
  mode_E->align = 32;
  mode_E->size = 80;
584
  mode_E->tv_priv = NULL;
585
586
587
588
589
590
591
592
593
594
595

  set_mode_values(mode_E);

  /* signed byte */
  mode_Bs = &modes[irm_Bs];
  mode_Bs->name = id_from_str("Bs", 2);
  mode_Bs->code = irm_Bs;
  mode_Bs->sort = int_number;
  mode_Bs->sign = 1;
  mode_Bs->align = 8;
  mode_Bs->size = 8;
596
  mode_Bs->tv_priv = NULL;
597
598
599
600
601
602
603
604
605
606
607

  set_mode_values(mode_Bs);

  /* unsigned byte */
  mode_Bu = &modes[irm_Bu];
  mode_Bu->name = id_from_str("Bu", 2);
  mode_Bu->code = irm_Bu;
  mode_Bu->sort = int_number;
  mode_Bu->sign = 0;
  mode_Bu->align = 8;
  mode_Bu->size = 8;
608
  mode_Bu->tv_priv = NULL;
609
610
611
612
613
614
615
616
617
618
619

  set_mode_values(mode_Bu);

  /* signed short integer */
  mode_Hs = &modes[irm_Hs];
  mode_Hs->name = id_from_str("Hs", 2);
  mode_Hs->code = irm_Hs;
  mode_Hs->sort = int_number;
  mode_Hs->sign = 1;
  mode_Hs->align = 16;
  mode_Hs->size = 16;
620
  mode_Hs->tv_priv = NULL;
621
622
623
624
625
626
627
628
629
630
631

  set_mode_values(mode_Hs);

  /* unsigned short integer */
  mode_Hu = &modes[irm_Hu];
  mode_Hu->name = id_from_str("Hu", 2);
  mode_Hu->code = irm_Hu;
  mode_Hu->sort = int_number;
  mode_Hu->sign = 0;
  mode_Hu->align = 16;
  mode_Hu->size = 16;
632
  mode_Hu->tv_priv = NULL;
633
634
635
636
637
638
639
640
641
642
643

  set_mode_values(mode_Hu);

  /* signed integer */
  mode_Is = &modes[irm_Is];
  mode_Is->name = id_from_str("Is", 2);
  mode_Is->code = irm_Is;
  mode_Is->sort = int_number;
  mode_Is->sign = 1;
  mode_Is->align = 32;
  mode_Is->size = 32;
644
  mode_Is->tv_priv = NULL;
645
646
647
648
649
650
651
652
653
654
655

  set_mode_values(mode_Is);

  /* unsigned integer */
  mode_Iu = &modes[irm_Iu];
  mode_Iu->name = id_from_str("Iu", 2);
  mode_Iu->code = irm_Iu;
  mode_Iu->sort = int_number;
  mode_Iu->sign = 0;
  mode_Iu->align = 32;
  mode_Iu->size = 32;
656
  mode_Iu->tv_priv = NULL;
657
658
659
660
661
662
663
664
665
666
667

  set_mode_values(mode_Iu);

  /* signed long integer */
  mode_Ls = &modes[irm_Ls];
  mode_Ls->name = id_from_str("Ls", 2);
  mode_Ls->code = irm_Ls;
  mode_Ls->sort = int_number;
  mode_Ls->sign = 1;
  mode_Ls->align = 32;
  mode_Ls->size = 64;
668
  mode_Ls->tv_priv = NULL;
669
670
671
672
673
674
675
676
677
678
679

  set_mode_values(mode_Ls);

  /* unsigned long integer */
  mode_Lu = &modes[irm_Lu];
  mode_Lu->name = id_from_str("Lu", 2);
  mode_Lu->code = irm_Lu;
  mode_Lu->sort = int_number;
  mode_Lu->sign = 0;
  mode_Lu->align = 32;
  mode_Lu->size = 64;
680
  mode_Lu->tv_priv = NULL;
681
682
683
684
685
686
687
688
689
690
691

  set_mode_values(mode_Lu);

  /* Character */
  mode_C = &modes[irm_C];
  mode_C->name = id_from_str("C", 1);
  mode_C->code = irm_C;
  mode_C->sort = character;
  mode_C->sign = 0;
  mode_C->align = 8;
  mode_C->size = 8;
692
  mode_C->tv_priv = NULL;
693
694
695
696
697
698
699
700
701
702
703

  set_mode_values(mode_C);

  /* Unicode character */
  mode_U = &modes[irm_U];
  mode_U->name = id_from_str("U", 1);
  mode_U->code = irm_U;
  mode_U->sort = character;
  mode_U->sign = 0;
  mode_U->align = 16;
  mode_U->size = 16;
704
  mode_U->tv_priv = NULL;
705
706
707
708
709
710
711
712
713
714
715

  set_mode_values(mode_U);

  /* pointer */
  mode_P = &modes[irm_P];
  mode_P->name = id_from_str("P", 1);
  mode_P->code = irm_P;
  mode_P->sort = reference;
  mode_P->sign = 0;
  mode_P->align = 32;
  mode_P->size = 32;
716
  mode_P->tv_priv = NULL;
717
718

  num_modes = irm_max;
719
}