PulkoMandy | 17fc759 | 2022-07-28 18:27:54 +0200 | [diff] [blame] | 1 | /* Z-machine code generator |
| 2 | * David Given |
| 3 | */ |
| 4 | |
| 5 | #include "dt.h" |
| 6 | |
| 7 | /* Machine specific addressing-modes. Not used. */ |
| 8 | |
| 9 | struct AddressingMode{ |
| 10 | int never_used; |
| 11 | }; |
| 12 | |
| 13 | /* The number of registers we support. We don't really have any, but we |
| 14 | * use local variables instead; we have 14. |
| 15 | */ |
| 16 | |
| 17 | #define MAXR 14 |
| 18 | |
| 19 | /* Number of command-line options we accept. */ |
| 20 | |
| 21 | #define MAXGF 6 |
| 22 | |
| 23 | /* If this is set to zero vbcc will not generate ICs where the target operand |
| 24 | * is the same as the 2nd source operand. This can sometimes simplify the |
| 25 | * code-generator, but usually the code is better if the code-generator allows |
| 26 | * it. |
| 27 | */ |
| 28 | |
| 29 | #define USEQ2ASZ 1 |
| 30 | |
| 31 | /* The smallest and largest integer type that can be added to a pointer. */ |
| 32 | |
| 33 | #define MINADDI2P INT |
| 34 | #define MAXADDI2P INT |
| 35 | |
| 36 | /* Big-endian? */ |
| 37 | |
| 38 | #define BIGENDIAN 1 |
| 39 | |
| 40 | /* Little-endian? */ |
| 41 | |
| 42 | #define LITTLEENDIAN 0 |
| 43 | |
| 44 | /* If switch-statements should be generated as a sequence of SUB,TST,BEQ ICs |
| 45 | * rather than COMPARE,BEQ ICs set this to 1. This can yield better code on |
| 46 | * some machines. |
| 47 | */ |
| 48 | |
| 49 | #define SWITCHSUBS 0 |
| 50 | |
| 51 | /* In optimizing compilation certain library memcpy/strcpy-calls with length |
| 52 | * known at compile-time will be inlined using an ASSIGN-IC if the size is less |
| 53 | * or equal to INLINEMEMCPY. The type used for the ASSIGN-IC will be |
| 54 | * UNSIGNED|CHAR. On the Z-machine, memcpy can be done in `hardware' with the |
| 55 | * @copy_table opcode, so always inline them if possible. |
| 56 | */ |
| 57 | |
| 58 | #define INLINEMEMCPY 65536 |
| 59 | |
| 60 | /* Do we want to pass parameters to functions in registers? */ |
| 61 | |
| 62 | #define HAVE_REGPARMS 1 |
| 63 | |
| 64 | /* If so, how many? Max 7 due to the architecture, but one is always xp. */ |
| 65 | |
| 66 | #define NUM_REGPARMS 6 |
| 67 | |
| 68 | /* This structure is used to keep track of where register parameters go. */ |
| 69 | |
| 70 | struct reg_handle { |
| 71 | int reg; |
| 72 | }; |
| 73 | |
| 74 | /* Do we want to use zuint for size_t rather than the default zulong? */ |
| 75 | |
| 76 | #define HAVE_INT_SIZET 1 |
| 77 | |
| 78 | /* size of buffer for asm-output */ |
| 79 | #define EMIT_BUF_LEN 1024 /* should be enough */ |
| 80 | /* number of asm-output lines buffered */ |
| 81 | #define EMIT_BUF_DEPTH 4 |