2 mcs51 specific general functions.
4 Note that mlh prepended _mcs51_ on the static functions. Makes
5 it easier to set a breakpoint using the debugger.
12 static char _defaultRules[] =
17 /* list of key words used by msc51 */
18 static char *_mcs51_keywords[] =
47 void mcs51_assignRegisters (eBBlock ** ebbs, int count);
49 static int regParmFlg = 0; /* determine if we can register a parameter */
54 asm_addTree (&asm_asxxxx_mapping);
58 _mcs51_reset_regparm ()
64 _mcs51_regparm (sym_link * l)
66 /* for this processor it is simple
67 can pass only the first parameter in a register */
76 _mcs51_parseOptions (int *pargc, char **argv, int *i)
78 /* TODO: allow port-specific command line options to specify
85 _mcs51_finaliseOptions (void)
87 if (options.model == MODEL_LARGE) {
88 port->mem.default_local_map = xdata;
89 port->mem.default_globl_map = xdata;
93 port->mem.default_local_map = data;
94 port->mem.default_globl_map = data;
99 _mcs51_setDefaultOptions (void)
104 _mcs51_getRegName (struct regs *reg)
112 _mcs51_genAssemblerPreamble (FILE * of)
116 /* Generate interrupt vector table. */
118 _mcs51_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
123 /* Do CSE estimation */
124 static bool cseCostEstimation (iCode *ic, iCode *pdic)
126 operand *result = IC_RESULT(ic);
127 operand *right = IC_RIGHT(ic);
128 operand *left = IC_LEFT(ic);
129 sym_link *result_type = operandType(result);
130 sym_link *right_type = (right ? operandType(right) : 0);
131 sym_link *left_type = (left ? operandType(left) : 0);
133 /* if it is a pointer then return ok for now */
134 if (IC_RESULT(ic) && IS_PTR(result_type)) return 1;
136 /* if bitwise | add & subtract then no since mcs51 is pretty good at it
137 so we will cse only if they are local (i.e. both ic & pdic belong to
138 the same basic block */
139 if (IS_BITWISE_OP(ic) || ic->op == '+' || ic->op == '-') {
140 /* then if they are the same Basic block then ok */
141 if (ic->eBBlockNum == pdic->eBBlockNum) return 1;
145 /* for others it is cheaper to do the cse */
149 /** $1 is always the basename.
150 $2 is always the output file.
152 $l is the list of extra options that should be there somewhere...
153 MUST be terminated with a NULL.
155 static const char *_linkCmd[] =
157 "{bindir}{sep}aslink", "-nf", "$1", NULL
160 /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
161 static const char *_asmCmd[] =
163 "asx8051", "$l", "$3", "$1.asm", NULL
171 "MCU 8051", /* Target name */
173 TRUE, /* Emit glue around main */
174 MODEL_SMALL | MODEL_LARGE,
180 "-plosgffc", /* Options with debug */
181 "-plosgff", /* Options without debug */
195 /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
196 1, 2, 2, 4, 1, 2, 3, 1, 4, 4
218 /* mcs51 has an 8 bit mul */
225 _mcs51_finaliseOptions,
226 _mcs51_setDefaultOptions,
227 mcs51_assignRegisters,
230 _mcs51_genAssemblerPreamble,
232 _mcs51_reset_regparm,
240 1, /* transform <= to ! > */
241 1, /* transform >= to ! < */
242 1, /* transform != to !(a == b) */
244 FALSE, /* No array initializer support. */
246 NULL, /* no builtin functions */