PulkoMandy | 17fc759 | 2022-07-28 18:27:54 +0200 | [diff] [blame] | 1 | /* |
| 2 | Dalvik backend for vbcc |
| 3 | */ |
| 4 | |
| 5 | #include "dt.h" |
| 6 | |
| 7 | /* This struct can be used to implement machine-specific */ |
| 8 | /* addressing-modes. */ |
| 9 | /* Currently possible are (const,gpr) and (gpr,gpr) */ |
| 10 | struct AddressingMode{ |
| 11 | int flags; |
| 12 | int base; |
| 13 | long offset; |
| 14 | }; |
| 15 | |
| 16 | /* The number of registers of the target machine. */ |
| 17 | #define GPRS 256 |
| 18 | #define PAIRS (GPRS/2) |
| 19 | #define MAXR (GPRS + PAIRS) |
| 20 | |
| 21 | /* Number of commandline-options the code-generator accepts. */ |
| 22 | #define MAXGF 20 |
| 23 | |
| 24 | /* If this is set to zero vbcc will not generate ICs where the */ |
| 25 | /* target operand is the same as the 2nd source operand. */ |
| 26 | /* This can sometimes simplify the code-generator, but usually */ |
| 27 | /* the code is better if the code-generator allows it. */ |
| 28 | #define USEQ2ASZ 1 |
| 29 | |
| 30 | /* This specifies the smallest integer type that can be added to a */ |
| 31 | /* pointer. */ |
| 32 | #ifndef DV_BYTE8 |
| 33 | #define MINADDI2P CHAR |
| 34 | #else |
| 35 | #define MINADDI2P INT |
| 36 | #endif |
| 37 | |
| 38 | /* If the bytes of an integer are ordered most significant byte */ |
| 39 | /* byte first and then decreasing set BIGENDIAN to 1. */ |
| 40 | #define BIGENDIAN 0 |
| 41 | |
| 42 | /* If the bytes of an integer are ordered lest significant byte */ |
| 43 | /* byte first and then increasing set LITTLEENDIAN to 1. */ |
| 44 | #define LITTLEENDIAN 1 |
| 45 | |
| 46 | /* Note that BIGENDIAN and LITTLEENDIAN are mutually exclusive. */ |
| 47 | |
| 48 | /* If switch-statements should be generated as a sequence of */ |
| 49 | /* SUB,TST,BEQ ICs rather than COMPARE,BEQ ICs set this to 1. */ |
| 50 | /* This can yield better code on some machines. */ |
| 51 | #define SWITCHSUBS 0 |
| 52 | |
| 53 | /* In optimizing compilation certain library memcpy/strcpy-calls */ |
| 54 | /* with length known at compile-time will be inlined using an */ |
| 55 | /* ASSIGN-IC if the size is less or equal to INLINEMEMCPY. */ |
| 56 | /* The type used for the ASSIGN-IC will be UNSIGNED|CHAR. */ |
| 57 | #define INLINEMEMCPY 1024 |
| 58 | |
| 59 | /* Parameters are sometimes passed in registers without __reg. */ |
| 60 | #define HAVE_REGPARMS 1 |
| 61 | |
| 62 | /* Parameters on the stack should be pushed in order rather than */ |
| 63 | /* in reverse order. */ |
| 64 | #define ORDERED_PUSH FIXED_SP |
| 65 | |
| 66 | /* Structure for reg_parm(). */ |
| 67 | struct reg_handle{ |
| 68 | unsigned long regs; |
| 69 | }; |
| 70 | |
| 71 | /* We have some target-specific variable attributes. */ |
| 72 | #define HAVE_TARGET_ATTRIBUTES |
| 73 | |
| 74 | /* We have target-specific pragmas */ |
| 75 | #define HAVE_TARGET_PRAGMAS |
| 76 | |
| 77 | /* We keep track of all registers modified by a function. */ |
| 78 | #define HAVE_REGS_MODIFIED 1 |
| 79 | |
| 80 | /* We have a implement our own cost-functions to adapt |
| 81 | register-allocation */ |
| 82 | #define HAVE_TARGET_RALLOC 1 |
| 83 | #define cost_move_reg(x,y) 1 |
| 84 | #define cost_load_reg(x,y) 2 |
| 85 | #define cost_save_reg(x,y) 2 |
| 86 | #define cost_pushpop_reg(x) 3 |
| 87 | |
| 88 | /* size of buffer for asm-output, this can be used to do |
| 89 | peephole-optimizations of the generated assembly-output */ |
| 90 | #define EMIT_BUF_LEN 1024 /* should be enough */ |
| 91 | /* number of asm-output lines buffered */ |
| 92 | #define EMIT_BUF_DEPTH 4 |
| 93 | |
| 94 | /* We have no asm_peephole to optimize assembly-output */ |
| 95 | #define HAVE_TARGET_PEEPHOLE 0 |
| 96 | |
| 97 | /* we do not have a mark_eff_ics function, this is used to prevent |
| 98 | optimizations on code which can already be implemented by efficient |
| 99 | assembly */ |
| 100 | #undef HAVE_TARGET_EFF_IC |
| 101 | |
| 102 | /* we only need the standard data types (no bit-types, different pointers |
| 103 | etc.) */ |
| 104 | #undef HAVE_EXT_TYPES |
| 105 | #undef HAVE_TGT_PRINTVAL |
| 106 | |
| 107 | /* we do not need extra elements in the IC */ |
| 108 | #undef HAVE_EXT_IC |
| 109 | |
| 110 | /* we do not use unsigned int as size_t (but unsigned long, the default) */ |
| 111 | #undef HAVE_INT_SIZET |
| 112 | |
| 113 | /* we need register-pairs */ |
| 114 | ##define HAVE_REGPAIRS |
| 115 | |
| 116 | |
| 117 | /* do not create CONVERT ICs from integers smaller than int to floats */ |
| 118 | #define MIN_INT_TO_FLOAT_TYPE INT |
| 119 | |
| 120 | /* do not create CONVERT ICs from floats to ints smaller than int */ |
| 121 | #define MIN_FLOAT_TO_INT_TYPE INT |
| 122 | |
| 123 | /* do not create CONVERT_ICs from floats to unsigned integers */ |
| 124 | #define AVOID_FLOAT_TO_UNSIGNED 1 |
| 125 | |
| 126 | /* do not create CONVERT_ICs from unsigned integers to floats */ |
| 127 | #define AVOID_UNSIGNED_TO_FLOAT 1 |