X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Favr%2Fmain.c;h=828c3c033f19bee402fa721fa54dd7f2210cde01;hb=c2f2abbf9d58d7f0def3509779547f50ade2e2ab;hp=ba5a470bc05c3f28a665b0b5bc8526f0e32f7c7b;hpb=599e22008460e89814f7d5dd8a92d41a3f281cd2;p=fw%2Fsdcc diff --git a/src/avr/main.c b/src/avr/main.c index ba5a470b..828c3c03 100644 --- a/src/avr/main.c +++ b/src/avr/main.c @@ -42,13 +42,13 @@ _avr_init (void) } static void -_avr_reset_regparm () +_avr_reset_regparm (void) { regParmFlg = 0; } static int -_avr_regparm (sym_link * l) +_avr_regparm (sym_link * l, bool reentrant) { /* the first eight bytes will be passed in registers r16-r23. but we won't split variables @@ -69,7 +69,7 @@ _avr_regparm (sym_link * l) return 0; } -void avr_assignRegisters (eBBlock ** ebbs, int count); +void avr_assignRegisters (ebbIndex *); static bool _avr_parseOptions (int *pargc, char **argv, int *i) @@ -131,6 +131,29 @@ _avr_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts) return TRUE; } +/* Indicate which extended bit operations this port supports */ +static bool +hasExtBitOp (int op, int size) +{ + if (op == RRC + || op == RLC + || op == GETHBIT + ) + return TRUE; + else + return FALSE; +} + +/* Indicate the expense of an access to an output storage class */ +static int +oclsExpense (struct memmap *oclass) +{ + if (IN_FARSPACE(oclass)) + return 1; + + return 0; +} + /** $1 is always the basename. $2 is always the output file. $3 varies @@ -138,12 +161,12 @@ _avr_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts) MUST be terminated with a NULL. */ static const char *_linkCmd[] = { - "linkavr", "", "$1", NULL + "linkavr", "", "\"$1\"", NULL }; /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */ static const char *_asmCmd[] = { - "asavr", "$l" , "$3", "$1.s", NULL + "asavr", "$l" , "$3", "\"$1.s\"", NULL }; /* Globals */ @@ -151,22 +174,28 @@ PORT avr_port = { TARGET_ID_AVR, "avr", "ATMEL AVR", /* Target name */ + NULL, /* processor */ { + glue, TRUE, /* Emit glue around main */ MODEL_LARGE | MODEL_SMALL, - MODEL_SMALL}, + MODEL_SMALL + }, { _asmCmd, NULL, "-plosgff", /* Options with debug */ "-plosgff", /* Options without debug */ 0, - ".s"}, + ".s", + NULL, /* no do_assemble */ + }, { _linkCmd, NULL, NULL, - ".rel"}, + ".rel", + 1}, { _defaultRules}, { @@ -178,6 +207,7 @@ PORT avr_port = { "CSEG", "DSEG", "ISEG", + NULL, //PSEG "XSEG", "BSEG", "RSEG", @@ -185,32 +215,57 @@ PORT avr_port = { "OSEG", "GSFINAL", "HOME", + NULL, // initialized xdata + NULL, // a code copy of xiseg + "CONST (CODE)", // const_name - const data (code or not) NULL, NULL, 0, }, + { NULL, NULL }, { -1, 1, 4, 1, 1, 0}, /* avr has an 8 bit mul */ { 1, -1 }, + { + avr_emitDebuggerSymbol + }, + { + 255/3, /* maxCount */ + 3, /* sizeofElement */ + /* The rest of these costs are bogus. They approximate */ + /* the behavior of src/SDCCicode.c 1.207 and earlier. */ + {4,4,4}, /* sizeofMatchJump[] */ + {0,0,0}, /* sizeofRangeCompare[] */ + 0, /* sizeofSubtract */ + 3, /* sizeofDispatch */ + }, "_", _avr_init, _avr_parseOptions, + NULL, + NULL, _avr_finaliseOptions, _avr_setDefaultOptions, avr_assignRegisters, _avr_getRegName, _avr_keywords, _avr_genAssemblerPreamble, + NULL, /* no genAssemblerEnd */ _avr_genIVT, + NULL, // _avr_genXINIT + NULL, /* genInitStartup */ _avr_reset_regparm, _avr_regparm, NULL, NULL, NULL, + hasExtBitOp, /* hasExtBitOp */ + oclsExpense, /* oclsExpense */ FALSE, + TRUE, /* little endian */ 0, /* leave lt */ 1, /* transform gt ==> not le */ 0, /* leave le */ @@ -220,5 +275,8 @@ PORT avr_port = { FALSE, /* No array initializer support. */ 0, /* no CSE cost estimation yet */ NULL, /* no builtin functions */ + GPOINTER, /* treat unqualified pointers as "generic" pointers */ + 1, /* reset labelKey to 1 */ + 1, /* globals & local static allowed */ PORT_MAGIC };