Changed the makefile system to autoconf/automake.
[cacao.git] / comp / defines.c
1 /******************************** comp/defines.c *******************************
2
3         Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
4
5         See file COPYRIGHT for information on usage and disclaimer of warranties
6
7         defines all the constants and data structures of the compiler 
8         
9         Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
10                  Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
11                  Michael Gschwind    EMAIL: cacao@complang.tuwien.ac.at
12                   
13         Last Change: 1997/09/22
14
15 *******************************************************************************/
16
17 #include "types.h"
18
19 /*********************** resolve typedef-cycles *******************************/
20
21 typedef struct stackinfo stackinfo;
22 typedef struct basicblock basicblock;
23 typedef struct varinfo varinfo;
24 typedef struct subroutineinfo subroutineinfo;
25
26
27 /***************************** basic block structure **************************/
28
29 #define BLOCKTYPE_JAVA        1
30 #define BLOCKTYPE_EXCREATOR   2
31 #define BLOCKTYPE_EXFORWARDER 3
32
33 /* there are three kinds of basic blocks:
34         JAVA  ........ block which contains JavaVM code (normal case)
35         EXCREATOR  ... block which creates an exception and calls the handler
36         EXFORWARDER .. block which does the dispatching to all possible handlers
37 */
38
39 struct basicblock {
40         u2  type;           /* block type */
41         bool reached;       /* true, when block has been reached; the field stack
42                                contains the stack valid before entering block */
43         bool finished;      /* true, if 'pcmdlist' is finished */
44         subroutineinfo *subroutine;  /* info about blocks reachable by JSR */
45         listnode linkage;       /* list chaining */
46         u4 jpc;             /* JavaVM program counter at start of block */
47         stackinfo *stack;   /* stack description */
48         list pcmdlist;      /* list of pseudo commands */
49         u4 mpc;             /* program counter within compiled machine code */
50         java_objectheader *exproto;
51                             /* if (type==EXCREATOR) contains pointer to exception
52                                raising object */
53         varinfo *exvar;     /* if (type==EXFORWARDER) contains exception variable */
54         u4 throwpos;        /* if (type!=JAVA) contains position in program where
55                                the exception was raised */
56         };
57
58
59 /***************************** subroutine structure ***************************/
60
61 struct subroutineinfo {
62         bool returnfinished;     /* true if return allready has been processed */
63
64         stackinfo *returnstack;  /* stack structure at position of return */
65         chain *callers;          /* a list of all callers */
66         u2 counter;
67         };
68
69
70 /************************** stack element structure ***************************/
71
72 struct stackinfo {
73         stackinfo *prev; /* pointer to next element towards bootom */
74         varinfo *var;    /* pointer to variable which contains this value */
75         };
76
77
78 /************************* pseudo variable structure **************************/
79
80 struct varinfo {
81         listnode linkage;      /* list chaining */
82
83         u2 type;               /* basic type of variable */
84         u2 number;             /* sequential numbering (used for debugging) */
85
86         bool saved;            /* true if variable sould survive subroutine calls */
87
88         struct reginfo *reg;   /* registerused by variable */
89
90         /* temporary fields used during parsing */
91
92         list copies;           /* list of all variables which are copies */
93         listnode copylink;     /* chaining for copy list */
94         varinfo *original;     /* pointer to original variable (self reference
95                                   is possible) */
96
97         bool globalscope;      /* true if variable is activ in whole subroutine */
98         bool active;           /* true if variable is currently active (parsing
99                                   a block where the variable is valid ) */
100         };
101
102
103 typedef varinfo *varid;
104
105 #define NOVAR NULL
106
107
108 /************************** pseudo command structure **************************/
109
110 /* pseudo command tags */
111
112 #define TAG_LOADCONST_I  1      /* load integer constant */
113 #define TAG_LOADCONST_L  2      /* load long constant    */
114 #define TAG_LOADCONST_F  3      /* load float constant   */
115 #define TAG_LOADCONST_D  4      /* load double constant  */
116 #define TAG_LOADCONST_A  5      /* load address constant */
117 #define TAG_MOVE         6
118 #define TAG_OP           7
119 #define TAG_MEM          8
120 #define TAG_BRA          9
121 #define TAG_TABLEJUMP   10
122 #define TAG_METHOD      11
123 #define TAG_DROP        12
124 #define TAG_ACTIVATE    13
125
126
127 typedef struct pcmd {
128         listnode linkage;           /* list chaining */
129         int tag;                    /* kind of pseudo command */
130         int opcode;                 /* opcode and kind of pseudo command */
131
132         varinfo *dest;              /* optional destination operand */
133         varinfo *source1;           /* 3 optional source operands */
134         varinfo *source2;
135         varinfo *source3;
136
137         union {
138                 struct {                /* load integer constant */
139                         s4 value;
140                         } i;
141                 struct {                /* load long constant    */
142                         s8 value;
143                         } l;
144                 struct {                /* load float constant   */
145                         float value;
146                         } f;
147                 struct {                /* load double constant  */
148                         double value;
149                         } d;
150                 struct {                /* load address constant */
151                         voidptr value;
152                         } a;
153
154                 struct {                /* move */
155                         u2 type;                /* type of value */
156                         } move;
157
158                 struct {                /* memory access (load/store) */
159                         int type;               /* access type */
160                         u4  offset;             /* offset relative to base register */
161                         } mem;
162
163         struct {                /* branch */
164                         basicblock *target;     /* branch target */
165                         } bra;
166
167                 struct {                /* branch using table */
168                         u4 targetcount;         /* number of entries */
169                         basicblock **targets;   /* branch target */
170                         } tablejump;
171
172                 struct {                /* method call */
173                         methodinfo *method;     /* pointer to 'methodinfo'-structure */
174                         functionptr builtin;    /* C function pointer or NULL */
175                         u2 paramnum;            /* number of parameters */
176                         varid *params;          /* table of parameter variables */
177                         varid exceptionvar;     /* exception variable */
178                         } method;
179
180                 } u;
181
182         } pcmd;
183
184
185
186
187
188
189 /***************** forward references in branch instructions ******************/
190
191 typedef struct mcodereference {
192         listnode linkage;       /* list chaining */
193
194         bool incode;            /* true if code address, false if data address */
195         s4 msourcepos;          /* patching position in code/data segment */
196         basicblock *target;     /* target basic block */
197         } mcodereference;
198
199
200
201
202 /********** JavaVM operation codes (sortet) and instruction lengths ***********/
203
204 u1 jcommandsize[256] = {
205
206 #define CMD_NOP                         0
207                 1,
208 #define CMD_ACONST_NULL         1
209                 1,
210 #define CMD_ICONST_M1           2
211                 1,
212 #define CMD_ICONST_0            3
213                 1,
214 #define CMD_ICONST_1            4
215                 1,
216 #define CMD_ICONST_2            5
217                 1,
218 #define CMD_ICONST_3            6
219                 1,
220 #define CMD_ICONST_4            7
221                 1,
222 #define CMD_ICONST_5            8
223                 1,
224 #define CMD_LCONST_0            9
225                 1,
226 #define CMD_LCONST_1            10
227                 1,
228 #define CMD_FCONST_0            11
229                 1,
230 #define CMD_FCONST_1            12
231                 1,
232 #define CMD_FCONST_2            13
233                 1,
234 #define CMD_DCONST_0            14
235                 1,
236 #define CMD_DCONST_1            15
237                 1,
238 #define CMD_BIPUSH                      16
239                 2,
240 #define CMD_SIPUSH                      17
241                 3,
242 #define CMD_LDC1                        18
243                 2,
244 #define CMD_LDC2                        19
245                 3,
246 #define CMD_LDC2W                       20
247                 3,
248 #define CMD_ILOAD                       21
249                 2,
250 #define CMD_LLOAD                       22
251                 2,
252 #define CMD_FLOAD                       23
253                 2,
254 #define CMD_DLOAD                       24
255                 2,
256 #define CMD_ALOAD                       25
257                 2,
258 #define CMD_ILOAD_0             26
259                 1,
260 #define CMD_ILOAD_1             27
261                 1,
262 #define CMD_ILOAD_2             28
263                 1,
264 #define CMD_ILOAD_3             29
265                 1,
266 #define CMD_LLOAD_0             30
267                 1,
268 #define CMD_LLOAD_1             31
269                 1,
270 #define CMD_LLOAD_2             32
271                 1,
272 #define CMD_LLOAD_3             33
273                 1,
274 #define CMD_FLOAD_0             34
275                 1,
276 #define CMD_FLOAD_1             35
277                 1,
278 #define CMD_FLOAD_2             36
279                 1,
280 #define CMD_FLOAD_3             37
281                 1,
282 #define CMD_DLOAD_0             38
283                 1,
284 #define CMD_DLOAD_1             39
285                 1,
286 #define CMD_DLOAD_2             40
287                 1,
288 #define CMD_DLOAD_3             41
289                 1,
290 #define CMD_ALOAD_0             42
291                 1,
292 #define CMD_ALOAD_1             43
293                 1,
294 #define CMD_ALOAD_2             44
295                 1,
296 #define CMD_ALOAD_3             45
297                 1,
298 #define CMD_IALOAD                      46
299                 1,
300 #define CMD_LALOAD                      47
301                 1,
302 #define CMD_FALOAD                      48
303                 1,
304 #define CMD_DALOAD                      49
305                 1,
306 #define CMD_AALOAD                      50
307                 1,
308 #define CMD_BALOAD                      51
309                 1,
310 #define CMD_CALOAD                      52
311                 1,
312 #define CMD_SALOAD                      53
313                 1,
314 #define CMD_ISTORE                      54
315                 2,
316 #define CMD_LSTORE                      55
317                 2,
318 #define CMD_FSTORE                      56
319                 2,
320 #define CMD_DSTORE                      57
321                 2,
322 #define CMD_ASTORE                      58
323                 2,
324 #define CMD_ISTORE_0            59
325                 1,
326 #define CMD_ISTORE_1            60
327                 1,
328 #define CMD_ISTORE_2            61
329                 1,
330 #define CMD_ISTORE_3            62
331                 1,
332 #define CMD_LSTORE_0            63
333                 1,
334 #define CMD_LSTORE_1            64
335                 1,
336 #define CMD_LSTORE_2            65
337                 1,
338 #define CMD_LSTORE_3            66
339                 1,
340 #define CMD_FSTORE_0            67
341                 1,
342 #define CMD_FSTORE_1            68
343                 1,
344 #define CMD_FSTORE_2            69
345                 1,
346 #define CMD_FSTORE_3            70
347                 1,
348 #define CMD_DSTORE_0            71
349                 1,
350 #define CMD_DSTORE_1            72
351                 1,
352 #define CMD_DSTORE_2            73
353                 1,
354 #define CMD_DSTORE_3            74
355                 1,
356 #define CMD_ASTORE_0            75
357                 1,
358 #define CMD_ASTORE_1            76
359                 1,
360 #define CMD_ASTORE_2            77
361                 1,
362 #define CMD_ASTORE_3            78
363                 1,
364 #define CMD_IASTORE             79
365                 1,
366 #define CMD_LASTORE             80
367                 1,
368 #define CMD_FASTORE             81
369                 1,
370 #define CMD_DASTORE             82
371                 1,
372 #define CMD_AASTORE             83
373                 1,
374 #define CMD_BASTORE                 84
375                 1,
376 #define CMD_CASTORE             85
377                 1,
378 #define CMD_SASTORE             86
379                 1,
380 #define CMD_POP                     87
381                 1,
382 #define CMD_POP2                    88
383                 1,
384 #define CMD_DUP                     89
385                 1,
386 #define CMD_DUP_X1                  90
387                 1,
388 #define CMD_DUP_X2                  91
389                 1,
390 #define CMD_DUP2                    92
391                 1,
392 #define CMD_DUP2_X1             93
393                 1,
394 #define CMD_DUP2_X2             94
395                 1,
396 #define CMD_SWAP                        95
397                 1,
398 #define CMD_IADD                        96
399                 1,
400 #define CMD_LADD                        97
401                 1,
402 #define CMD_FADD                        98
403                 1,
404 #define CMD_DADD                        99
405                 1,
406 #define CMD_ISUB                        100
407                 1,
408 #define CMD_LSUB                        101
409                 1,
410 #define CMD_FSUB                        102
411                 1,
412 #define CMD_DSUB                        103
413                 1,
414 #define CMD_IMUL                        104
415                 1,
416 #define CMD_LMUL                        105
417                 1,
418 #define CMD_FMUL                        106
419                 1,
420 #define CMD_DMUL                        107
421                 1,
422 #define CMD_IDIV                        108
423                 1,
424 #define CMD_LDIV                        109
425                 1,
426 #define CMD_FDIV                        110
427                 1,
428 #define CMD_DDIV                        111
429                 1,
430 #define CMD_IREM                        112
431                 1,
432 #define CMD_LREM                        113
433                 1,
434 #define CMD_FREM                        114
435                 1,
436 #define CMD_DREM                        115
437                 1,
438 #define CMD_INEG                        116
439                 1,
440 #define CMD_LNEG                        117
441                 1,
442 #define CMD_FNEG                        118
443                 1,
444 #define CMD_DNEG                        119
445                 1,
446 #define CMD_ISHL                        120
447                 1,
448 #define CMD_LSHL                        121
449                 1,
450 #define CMD_ISHR                        122
451                 1,
452 #define CMD_LSHR                        123
453                 1,
454 #define CMD_IUSHR                       124
455                 1,
456 #define CMD_LUSHR                       125
457                 1,
458 #define CMD_IAND                        126
459                 1,
460 #define CMD_LAND                        127
461                 1,
462 #define CMD_IOR                         128
463                 1,
464 #define CMD_LOR                         129
465                 1,
466 #define CMD_IXOR                        130
467                 1,
468 #define CMD_LXOR                        131
469                 1,
470 #define CMD_IINC                        132
471                 3,
472 #define CMD_I2L                         133
473                 1,
474 #define CMD_I2F                         134
475                 1,
476 #define CMD_I2D                         135
477                 1,
478 #define CMD_L2I                         136
479                 1,
480 #define CMD_L2F                         137
481                 1,
482 #define CMD_L2D                         138
483                 1,
484 #define CMD_F2I                         139
485                 1,
486 #define CMD_F2L                         140
487                 1,
488 #define CMD_F2D                     141
489                 1,
490 #define CMD_D2I                     142
491                 1,
492 #define CMD_D2L                     143
493                 1,
494 #define CMD_D2F                     144
495                 1,
496 #define CMD_INT2BYTE            145
497                 1,
498 #define CMD_INT2CHAR            146
499                 1,
500 #define CMD_INT2SHORT           147
501                 1,
502 #define CMD_LCMP                    148
503                 1,
504 #define CMD_FCMPL                   149
505                 1,
506 #define CMD_FCMPG                   150
507                 1,
508 #define CMD_DCMPL                   151
509                 1,
510 #define CMD_DCMPG                   152
511                 1,
512 #define CMD_IFEQ                    153
513                 3,
514 #define CMD_IFNE                    154
515                 3,
516 #define CMD_IFLT                    155
517                 3,
518 #define CMD_IFGE                    156
519                 3,
520 #define CMD_IFGT                    157
521                 3,
522 #define CMD_IFLE                    158
523                 3,
524 #define CMD_IF_ICMPEQ           159
525                 3,
526 #define CMD_IF_ICMPNE           160
527                 3,
528 #define CMD_IF_ICMPLT           161
529                 3,
530 #define CMD_IF_ICMPGE           162
531                 3,
532 #define CMD_IF_ICMPGT           163
533                 3,
534 #define CMD_IF_ICMPLE           164
535                 3,
536 #define CMD_IF_ACMPEQ           165
537                 3,
538 #define CMD_IF_ACMPNE           166
539                 3,
540 #define CMD_GOTO                    167
541                 3,
542 #define CMD_JSR                     168
543                 3,
544 #define CMD_RET                     169
545                 2,
546 #define CMD_TABLESWITCH     170
547                 0,  /* length must be computed */
548 #define CMD_LOOKUPSWITCH    171
549                 0,  /* length must be computed */
550 #define CMD_IRETURN             172
551                 1,
552 #define CMD_LRETURN             173
553                 1,
554 #define CMD_FRETURN             174
555                 1,
556 #define CMD_DRETURN             175
557                 1,
558 #define CMD_ARETURN             176
559                 1,
560 #define CMD_RETURN                  177
561                 1,
562 #define CMD_GETSTATIC       178
563                 3,
564 #define CMD_PUTSTATIC       179
565                 3,
566 #define CMD_GETFIELD        180
567                 3,
568 #define CMD_PUTFIELD        181
569                 3,
570 #define CMD_INVOKEVIRTUAL   182
571                 3,
572 #define CMD_INVOKESPECIAL   183
573                 3,
574 #define CMD_INVOKESTATIC        184
575                 3,
576 #define CMD_INVOKEINTERFACE 185
577                 5,
578                 1, /* unused */
579 #define CMD_NEW             187
580                 3,
581 #define CMD_NEWARRAY            188
582                 2,
583 #define CMD_ANEWARRAY           189
584                 3,
585 #define CMD_ARRAYLENGTH         190
586                 1,
587 #define CMD_ATHROW              191
588                 1,
589 #define CMD_CHECKCAST           192
590                 3,
591 #define CMD_INSTANCEOF          193
592                 3,
593 #define CMD_MONITORENTER        194
594                 1,
595 #define CMD_MONITOREXIT         195
596                 1,
597 #define CMD_WIDE            196
598                 0,       /* length must be computed */
599 #define CMD_MULTIANEWARRAY      197
600                 4,
601 #define CMD_IFNULL          198
602                 3,
603 #define CMD_IFNONNULL       199
604                 3,
605 #define CMD_GOTO_W          200
606                 5,
607 #define CMD_JSR_W               201
608                 5,
609 #define CMD_BREAKPOINT      202
610                 1,
611
612                 1,1,1,1,1,1,1,1,1,1,            /* unused */
613                 1,1,1,1,1,1,1,1,1,1,
614                 1,1,1,1,1,1,1,1,1,1,
615                 1,1,1,1,1,1,1,1,1,1,
616                 1,1,1,1,1,1,1,1,1,1,
617                 1,1,1
618         };
619
620 #define CMD_TRACEBUILT      253     /* internal opcode */
621 #define CMD_IFEQL           254     /* internal opcode */
622 #define CMD_IF_UCMPGE       255     /* internal opcode */
623
624 #define CMD_LOADCONST_I (CMD_IF_UCMPGE+TAG_LOADCONST_I)   /* internal opcodes */
625 #define CMD_LOADCONST_L (CMD_IF_UCMPGE+TAG_LOADCONST_L)
626 #define CMD_LOADCONST_F (CMD_IF_UCMPGE+TAG_LOADCONST_F)
627 #define CMD_LOADCONST_D (CMD_IF_UCMPGE+TAG_LOADCONST_D)
628 #define CMD_LOADCONST_A (CMD_IF_UCMPGE+TAG_LOADCONST_A)
629 #define CMD_MOVE        (CMD_IF_UCMPGE+TAG_MOVE)
630
631 #define CMD_TABLEJUMP   (CMD_IF_UCMPGE+TAG_TABLEJUMP)
632 #define CMD_BUILTIN     (CMD_IF_UCMPGE+TAG_METHOD)
633 #define CMD_DROP        (CMD_IF_UCMPGE+TAG_DROP)
634 #define CMD_ACTIVATE    (CMD_IF_UCMPGE+TAG_ACTIVATE)
635
636
637 /******************* description of JavaVM instructions ***********************/
638
639 typedef struct {
640         u1 opcode;
641         u1 type_s1;
642         u1 type_s2;
643         u1 type_d;      
644         functionptr builtin;
645         bool supported;
646         bool isfloat;
647 } stdopdescriptor;
648
649 stdopdescriptor *stdopdescriptors[256];
650
651 stdopdescriptor stdopdescriptortable[] = {
652         { CMD_IADD,   TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
653         { CMD_ISUB,   TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
654         { CMD_IMUL,   TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
655         { CMD_ISHL,   TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
656         { CMD_ISHR,   TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
657         { CMD_IUSHR,  TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
658         { CMD_IAND,   TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
659         { CMD_IOR,    TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
660         { CMD_IXOR,   TYPE_INT, TYPE_INT, TYPE_INT, NULL, true, false },
661         { CMD_INEG,   TYPE_INT, TYPE_VOID,TYPE_INT, NULL, true, false },
662
663         { CMD_LADD,   TYPE_LONG, TYPE_LONG, TYPE_LONG, 
664                (functionptr) builtin_ladd , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
665         { CMD_LSUB,   TYPE_LONG, TYPE_LONG, TYPE_LONG,
666                (functionptr) builtin_lsub , SUPPORT_LONG && SUPPORT_LONG_ADD, false },
667         { CMD_LMUL,   TYPE_LONG, TYPE_LONG, TYPE_LONG,
668                (functionptr) builtin_lmul , SUPPORT_LONG && SUPPORT_LONG_MULDIV, false },
669         { CMD_LSHL,   TYPE_LONG, TYPE_INT,  TYPE_LONG,
670                (functionptr) builtin_lshl , SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
671         { CMD_LSHR,   TYPE_LONG, TYPE_INT,  TYPE_LONG,
672                (functionptr) builtin_lshr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
673         { CMD_LUSHR,  TYPE_LONG, TYPE_INT,  TYPE_LONG,
674                (functionptr) builtin_lushr, SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
675         { CMD_LAND,   TYPE_LONG, TYPE_LONG, TYPE_LONG,
676                (functionptr) builtin_land, SUPPORT_LONG && SUPPORT_LONG_LOG, false },
677         { CMD_LOR,    TYPE_LONG, TYPE_LONG, TYPE_LONG,
678                (functionptr) builtin_lor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
679         { CMD_LXOR,   TYPE_LONG, TYPE_LONG, TYPE_LONG,
680                (functionptr) builtin_lxor, SUPPORT_LONG && SUPPORT_LONG_LOG, false },
681         { CMD_LNEG,   TYPE_LONG, TYPE_VOID, TYPE_LONG,
682                (functionptr) builtin_lneg, SUPPORT_LONG && SUPPORT_LONG_ADD, false },
683         { CMD_LCMP,   TYPE_LONG, TYPE_LONG, TYPE_INT,
684                (functionptr) builtin_lcmp, SUPPORT_LONG && SUPPORT_LONG_CMP, false },
685
686         { CMD_FADD,   TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, 
687                (functionptr) builtin_fadd, SUPPORT_FLOAT, true },
688         { CMD_FSUB,   TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, 
689                (functionptr) builtin_fsub, SUPPORT_FLOAT, true },
690         { CMD_FMUL,   TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, 
691                (functionptr) builtin_fmul, SUPPORT_FLOAT, true },
692         { CMD_FDIV,   TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, 
693                (functionptr) builtin_fdiv, SUPPORT_FLOAT, true },
694         { CMD_FREM,   TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, 
695                (functionptr) builtin_frem, SUPPORT_FLOAT, true },
696         { CMD_FNEG,   TYPE_FLOAT, TYPE_VOID,  TYPE_FLOAT, 
697                (functionptr) builtin_fneg, SUPPORT_FLOAT, true },
698         { CMD_FCMPL,  TYPE_FLOAT, TYPE_FLOAT, TYPE_INT,   
699                (functionptr) builtin_fcmpl, SUPPORT_FLOAT, true },
700         { CMD_FCMPG,  TYPE_FLOAT, TYPE_FLOAT, TYPE_INT,   
701                (functionptr) builtin_fcmpg, SUPPORT_FLOAT, true },
702
703         { CMD_DADD,   TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, 
704                (functionptr) builtin_dadd, SUPPORT_DOUBLE, true },
705         { CMD_DSUB,   TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, 
706                (functionptr) builtin_dsub, SUPPORT_DOUBLE, true },
707         { CMD_DMUL,   TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, 
708                (functionptr) builtin_dmul, SUPPORT_DOUBLE, true },
709         { CMD_DDIV,   TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, 
710                (functionptr) builtin_ddiv, SUPPORT_DOUBLE, true },
711         { CMD_DREM,   TYPE_DOUBLE, TYPE_DOUBLE, TYPE_DOUBLE, 
712                (functionptr) builtin_drem, SUPPORT_DOUBLE, true },
713         { CMD_DNEG,   TYPE_DOUBLE, TYPE_VOID,  TYPE_DOUBLE, 
714                (functionptr) builtin_dneg, SUPPORT_DOUBLE, true },
715         { CMD_DCMPL,  TYPE_DOUBLE, TYPE_DOUBLE, TYPE_INT, 
716                (functionptr) builtin_dcmpl, SUPPORT_DOUBLE, true },
717         { CMD_DCMPG,  TYPE_DOUBLE, TYPE_DOUBLE, TYPE_INT, 
718                (functionptr) builtin_dcmpg, SUPPORT_DOUBLE, true },
719
720         { CMD_INT2BYTE, TYPE_INT, TYPE_VOID, TYPE_INT, NULL, true,false },
721         { CMD_INT2CHAR, TYPE_INT, TYPE_VOID, TYPE_INT, NULL, true,false },
722         { CMD_INT2SHORT, TYPE_INT, TYPE_VOID, TYPE_INT, NULL, true,false },
723         { CMD_I2L,    TYPE_INT,  TYPE_VOID, TYPE_LONG,   
724            (functionptr) builtin_i2l, SUPPORT_LONG && SUPPORT_LONG_ICVT, false },
725         { CMD_I2F,    TYPE_INT,  TYPE_VOID, TYPE_FLOAT,  
726                (functionptr) builtin_i2f, SUPPORT_FLOAT, true },
727         { CMD_I2D,    TYPE_INT,  TYPE_VOID, TYPE_DOUBLE, 
728                (functionptr) builtin_i2d, SUPPORT_DOUBLE, true },
729         { CMD_L2I,    TYPE_LONG, TYPE_VOID, TYPE_INT,    
730                (functionptr) builtin_l2i, SUPPORT_LONG && SUPPORT_LONG_ICVT, false },
731         { CMD_L2F,    TYPE_LONG, TYPE_VOID, TYPE_FLOAT,  
732                (functionptr) builtin_l2f, SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT, true },
733         { CMD_L2D,    TYPE_LONG, TYPE_VOID, TYPE_DOUBLE, 
734                (functionptr) builtin_l2d, SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT, true },
735         { CMD_F2I,    TYPE_FLOAT, TYPE_VOID, TYPE_INT,   
736                (functionptr) builtin_f2i, SUPPORT_FLOAT, true },
737         { CMD_F2L,    TYPE_FLOAT, TYPE_VOID, TYPE_LONG,   
738                (functionptr) builtin_f2l, SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
739         { CMD_F2D,    TYPE_FLOAT, TYPE_VOID, TYPE_DOUBLE, 
740                (functionptr) builtin_f2d, SUPPORT_FLOAT && SUPPORT_DOUBLE, true },
741         { CMD_D2I,    TYPE_DOUBLE, TYPE_VOID, TYPE_INT,   
742                (functionptr) builtin_d2i, SUPPORT_DOUBLE, true },
743         { CMD_D2L,    TYPE_DOUBLE, TYPE_VOID, TYPE_LONG,   
744                (functionptr) builtin_d2l, SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_FCVT, true },
745         { CMD_D2F,    TYPE_DOUBLE, TYPE_VOID, TYPE_FLOAT, 
746                (functionptr) builtin_d2f, SUPPORT_DOUBLE && SUPPORT_FLOAT, true },
747         
748 };
749
750
751
752 /***************************** register types *********************************/
753
754 #define REG_RES   0         /* reserved register for OS or code generator */
755 #define REG_RET   1         /* return value register */
756 #define REG_EXC   2         /* exception value register */
757 #define REG_SAV   3         /* (callee) saved register */
758 #define REG_TMP   4         /* scratch temporary register (caller saved) */
759 #define REG_ARG   5         /* argument register (caller saved) */
760
761 #define REG_END   -1        /* last entry in tables */
762  
763 #define PARAMMODE_NUMBERED  0 
764 #define PARAMMODE_STUFFED   1
765
766 /***************************** register info block ****************************/
767
768 extern int regdescint[];    /* description of integer registers */
769 extern int regdescfloat[];  /* description of floating point registers */
770
771 extern int reg_parammode;
772