#define OPTION_CALLEE_SAVES_BC "--callee-saves-bc"
#define OPTION_PORTMODE "--portmode="
#define OPTION_ASM "--asm="
+#define OPTION_NO_STD_CRT0 "--no-std-crt0"
static char _z80_defaultRules[] =
static OPTION _z80_options[] =
{
{ 0, OPTION_CALLEE_SAVES_BC, &z80_opts.calleeSavesBC, "Force a called function to always save BC" },
- { 0, OPTION_PORTMODE, NULL, "Determine PORT I/O mode (z80/z180)" },
- { 0, OPTION_ASM, NULL, "Define assembler name (rgbds/asxxxx/isas/z80asm)" },
- { 0, OPTION_CODE_SEG, NULL, "<name> use this name for the code segment" },
- { 0, OPTION_CONST_SEG, NULL, "<name> use this name for the const segment" },
+ { 0, OPTION_PORTMODE, NULL, "Determine PORT I/O mode (z80/z180)" },
+ { 0, OPTION_ASM, NULL, "Define assembler name (rgbds/asxxxx/isas/z80asm)" },
+ { 0, OPTION_CODE_SEG, &options.code_seg, "<name> use this name for the code segment", CLAT_STRING },
+ { 0, OPTION_CONST_SEG, &options.const_seg, "<name> use this name for the const segment", CLAT_STRING },
+ { 0, OPTION_NO_STD_CRT0, &options.no_std_crt0, "For the z80/gbz80 do not link default crt0.o"},
{ 0, NULL }
};
static OPTION _gbz80_options[] =
{
- { 0, OPTION_BO, NULL, "<num> use code bank <num>" },
- { 0, OPTION_BA, NULL, "<num> use data bank <num>" },
+ { 0, OPTION_BO, NULL, "<num> use code bank <num>" },
+ { 0, OPTION_BA, NULL, "<num> use data bank <num>" },
{ 0, OPTION_CALLEE_SAVES_BC, &z80_opts.calleeSavesBC, "Force a called function to always save BC" },
- { 0, OPTION_CODE_SEG, NULL, "<name> use this name for the code segment" },
- { 0, OPTION_CONST_SEG, NULL, "<name> use this name for the const segment" },
+ { 0, OPTION_CODE_SEG, &options.code_seg, "<name> use this name for the code segment", CLAT_STRING },
+ { 0, OPTION_CONST_SEG, &options.const_seg, "<name> use this name for the const segment", CLAT_STRING },
+ { 0, OPTION_NO_STD_CRT0, &options.no_std_crt0, "For the z80/gbz80 do not link default crt0.o"},
{ 0, NULL }
};
#include "mappings.i"
static builtins _z80_builtins[] = {
- /* Disabled for now.
- { "__builtin_strcpy", "v", 2, {"cg*", "cg*" } },
- { "__builtin_memcpy", "cg*", 3, {"cg*", "cg*", "ui" } },
- */
- { NULL , NULL,0, {NULL}}
+ { "__builtin_memcpy", "vg*", 3, {"vg*", "vg*", "ui" } },
+ { NULL , NULL, 0, {NULL}}
};
static void
return TRUE;
}
}
- else if (!strcmp (argv[*i], OPTION_CODE_SEG))
- {
- if (options.code_seg) Safe_free(options.code_seg);
- options.code_seg = Safe_strdup(getStringArg (OPTION_CODE_SEG, argv, i, *pargc));
- return TRUE;
- }
- else if (!strcmp (argv[*i], OPTION_CONST_SEG))
- {
- if (options.const_seg) Safe_free(options.const_seg);
- options.const_seg = Safe_strdup(getStringArg (OPTION_CONST_SEG, argv, i, *pargc));
- return TRUE;
- }
}
return FALSE;
}
if (IS_GB)
{
- setMainValue ("z80outputtypeflag", "-z");
+ setMainValue ("z80outputtypeflag", "-Z");
setMainValue ("z80outext", ".gb");
}
else
optimize.loopInduction = 1;
}
-/* Mangaling format:
+/* Mangling format:
_fun_policy_params
where:
policy is the function policy
where:
r is 'r' for reentrant, 's' for static functions
s is 'c' for callee saves, 'r' for caller saves
- p is 'p' for profiling on, 'x' for profiling off
+ f is 'f' for profiling on, 'x' for profiling off
examples:
rr - reentrant, caller saves
params format:
sprintf(buffer, "%s_rr%s_%s", original,
options.profile ? "f" : "x",
- options.noRegParams ? "s" : "bds"
+ options.noRegParams ? "s" : "bds" /* MB: but the library only has hds variants ??? */
);
return Safe_strdup(buffer);
}
else if ( IS_LITERAL (right))
{
- test = left;
+ test = right;
val = OP_VALUE (IC_RIGHT (ic));
}
+ /* 8x8 unsigned multiplication code is shorter than
+ call overhead for the multiplication routine. */
+ else if ( IS_CHAR (right) && IS_UNSIGNED (right) &&
+ IS_CHAR (left) && IS_UNSIGNED(left) && !IS_GB)
+ {
+ return TRUE;
+ }
else
{
return FALSE;
MODEL_MEDIUM | MODEL_SMALL,
MODEL_SMALL
},
- {
+ { /* Assembler */
NULL,
ASMCMD,
- "-plosgff", /* Options with debug */
+ "-plosgffc", /* Options with debug */
"-plosgff", /* Options without debug */
0,
".asm"
},
- {
+ { /* Linker */
NULL,
LINKCMD,
NULL,
".o",
1
},
- {
- _z80_defaultRules
+ { /* Peephole optimizer */
+ _z80_defaultRules,
+ 0,
+ 0,
+ 0,
+ 0,
+ z80notUsed
},
{
/* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
0, /* leave == */
TRUE, /* Array initializer support. */
0, /* no CSE cost estimation yet */
- _z80_builtins, /* no builtin functions */
+ _z80_builtins, /* builtin functions */
GPOINTER, /* treat unqualified pointers as "generic" pointers */
1, /* reset labelKey to 1 */
1, /* globals & local static allowed */
{
NULL,
ASMCMD,
- "-plosgff", /* Options with debug */
+ "-plosgffc", /* Options with debug */
"-plosgff", /* Options without debug */
0,
".asm",