irmode.c 15.8 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
23
24
25
26
#if 0
#  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
27

28
29
30
/* * *
 * local values
 * * */
31

32
static long long count = 0;
Christian Schäfer's avatar
Christian Schäfer committed
33

34
35
36
37
38
39
40
/* dynamic array to hold all modes */
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

42
43
/* number of defined modes */
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
53
54
55
56
57
/* compare modes that don't need to have their code field
 * correctly set */
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
58

59
60
  return 0;
}
Matthias Heil's avatar
Matthias Heil committed
61

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

69
70
71
72
  for (i = 0; i < num_modes; i++)
  {
    if (modes_are_equal(m, &modes[i])) return &modes[i];
  }
Matthias Heil's avatar
Matthias Heil committed
73

74
75
  return NULL;
}
Christian Schäfer's avatar
Christian Schäfer committed
76

77
78
79
80
81
82
83
84
85
86
87
/* sets special values of modes */
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
88

89
/** Predefined modes **/
Christian Schäfer's avatar
Christian Schäfer committed
90

91
92
93
94
95
/* 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
96

97
98
99
100
/* 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
101

102
103
104
105
106
107
108
109
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
110

111
112
113
114
ir_mode *mode_C;
ir_mode *mode_U;
ir_mode *mode_b;
ir_mode *mode_P;
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
/* * *
 * 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
143
register_mode(ir_mode* new_mode)
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
{
  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");
      break;

    case float_number:
      assert(0 && "not yet implemented");
      break;

    case int_number:
    case reference:
    case character:
      break;

    default:
      assert(0);
  }
Christian Schäfer's avatar
Christian Schäfer committed
174

175
176
177
178
179
180
181
  /* 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
182

183
184
185
186
187
  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
188

189
  return mode;
Christian Schäfer's avatar
Christian Schäfer committed
190
191
192
}

/* Functions for the direct access to all attributes od a ir_mode */
193
194
195
196
197
198
199
200
#ifdef MODE_ACCESS_DEFINES
#  undef get_mode_modecode
#  undef get_mode_ident
#  undef get_mode_name
#  undef get_mode_sort
#  undef get_mode_size
#  undef get_mode_align
#endif
Christian Schäfer's avatar
Christian Schäfer committed
201
modecode
202
get_mode_modecode(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
203
{
204
  ANNOUNCE();
Christian Schäfer's avatar
Christian Schäfer committed
205
206
207
208
  return mode->code;
}

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

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

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

Christian Schäfer's avatar
Christian Schäfer committed
229
int
230
get_mode_size(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
231
{
232
  ANNOUNCE();
Christian Schäfer's avatar
Christian Schäfer committed
233
234
235
236
  return mode->size;
}

int
237
get_mode_align (ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
238
{
239
240
  ANNOUNCE();
  return mode->align;
Christian Schäfer's avatar
Christian Schäfer committed
241
}
242
243
244
245
246
247
248
249
250
251
#ifdef MODE_ACCESS_DEFINES
#  define get_mode_modecode(mode) (mode)->code
#  define get_mode_ident(mode) (mode)->name
#  define get_mode_name(mode) id_to_str((mode)->name)
#  define get_mode_sort(mode) (mode)->sort
#  define get_mode_size(mode) (mode)->size
#  define get_mode_align(mode) (mode)->align
#endif
int
get_mode_sign (ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
252
{
253
254
  ANNOUNCE();
  return mode->sign;
Christian Schäfer's avatar
Christian Schäfer committed
255
256
257
}

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

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

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

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

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

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

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

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

301
302
tarval *
get_mode_infinite(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
303
{
304
305
306
307
308
309
  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
310
311
}

312
313
tarval *
get_mode_NAN(ir_mode *mode)
Christian Schäfer's avatar
Christian Schäfer committed
314
{
315
316
317
318
319
320
  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
321
322
323
324
325
326
327
328
}

/* 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
329
   float = {irm_F, irm_D, irm_E}
Christian Schäfer's avatar
Christian Schäfer committed
330
331
332

   The set of "int" is defined as:
   -------------------------------
Matthias Heil's avatar
Matthias Heil committed
333
   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
334
335
336

   The set of "num" is defined as:
   -------------------------------
Matthias Heil's avatar
Matthias Heil committed
337
338
   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
339
340
341
342
            = {float || int}

   The set of "data" is defined as:
   -------------------------------
Matthias Heil's avatar
Matthias Heil committed
343
   data  = {irm_F, irm_D, irm_E irm_Bs, irm_Bu, irm_Hs, irm_Hu,
344
345
            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
346
347
348

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

   The set of "dataM" is defined as:
   ---------------------------------
Matthias Heil's avatar
Matthias Heil committed
355
   dataM = {irm_F, irm_D, irm_E, irm_Bs, irm_Bu, irm_Hs, irm_Hu,
356
            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
357
358
359
            = {data || irm_M}
*/

360
361
362
363
364
365
366
367
368
#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
369
370
371
int
mode_is_signed (ir_mode *mode)
{
372
373
374
  ANNOUNCE();
  assert(mode);
  return mode->sign;
Christian Schäfer's avatar
Christian Schäfer committed
375
376
}

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

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

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

401
int
Christian Schäfer's avatar
Christian Schäfer committed
402
403
mode_is_data (ir_mode *mode)
{
404
405
406
  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
407
408
409
410
411
}

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

int
mode_is_dataM (ir_mode *mode)
{
420
421
422
  ANNOUNCE();
  assert(mode);
  return (mode_is_data(mode) || get_mode_modecode(mode) == irm_M);
Christian Schäfer's avatar
Christian Schäfer committed
423
}
424
425
426
427
428
429
430
431
432
#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
433
/* Returns true if sm can be converted to lm without loss. */
434
int
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
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
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))
          {
            if ( mode_is_signed(lm) && (get_mode_size(lm) > get_mode_size(sm)) )
              return 1;
          }
          else if (mode_is_signed(lm))
          {
            if (get_mode_size(lm) > get_mode_size(sm) + 1)
              return 1;
          }
          else if (get_mode_size(lm) > get_mode_size(sm))
          {
            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)
           && (get_mode_size(lm) > get_mode_size(sm)) )
         return 1;
      break;

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

    default:
      break;
  }

  /* else */
  return 0;
}

/** ** initialization ** **/
void
init_mode (void)
{
  ANNOUNCE();
  /* init flexible array */
  modes = NEW_ARR_F(ir_mode, irm_max);
  modes_min = NEW_ARR_F(tarval*, irm_max);
  modes_max = NEW_ARR_F(tarval*, irm_max);
  modes_null = NEW_ARR_F(tarval*, irm_max);
  modes_one = NEW_ARR_F(tarval*, irm_max);

  /* 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;

  /* 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;

  /* 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;

  /* Tuple */
  mode_T = &modes[irm_T];
  mode_T->name = id_from_str("T", 1);
  mode_T->code = irm_T;
  mode_T->sign = 0;

  /* 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;

  /* 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;

  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;

  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;

  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;

  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;

  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;

  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;

  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;

  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;

  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;

  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;

  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;

  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;

  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;

  num_modes = irm_max;
699
}