mirror of
https://github.com/cc65/cc65.git
synced 2024-07-10 07:29:05 +00:00
Allow a more exact specification which growth factor is allowed when
generating code and favouring speed over size. git-svn-id: svn://svn.cc65.org/cc65/trunk@668 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
4ab743143b
commit
2fead58243
@ -677,7 +677,7 @@ void g_getimmed (unsigned flags, unsigned long val, unsigned offs)
|
|||||||
AddCodeLine ("\tsta\tsreg+1");
|
AddCodeLine ("\tsta\tsreg+1");
|
||||||
AddCodeLine ("\tsta\tsreg");
|
AddCodeLine ("\tsta\tsreg");
|
||||||
AddCodeLine ("\tldx\t#$%02X", (unsigned char) (val >> 8));
|
AddCodeLine ("\tldx\t#$%02X", (unsigned char) (val >> 8));
|
||||||
} else if ((val & 0xFFFF0000) == 0 && FavourSize == 0) {
|
} else if ((val & 0xFFFF0000) == 0 && CodeSizeFactor > 140) {
|
||||||
AddCodeLine ("\tlda\t#$00");
|
AddCodeLine ("\tlda\t#$00");
|
||||||
AddCodeLine ("\tsta\tsreg+1");
|
AddCodeLine ("\tsta\tsreg+1");
|
||||||
AddCodeLine ("\tsta\tsreg");
|
AddCodeLine ("\tsta\tsreg");
|
||||||
@ -820,19 +820,19 @@ void g_getlocal (unsigned flags, int offs)
|
|||||||
AddCodeLine ("\tdey");
|
AddCodeLine ("\tdey");
|
||||||
AddCodeLine ("\tora\t(sp),y");
|
AddCodeLine ("\tora\t(sp),y");
|
||||||
} else {
|
} else {
|
||||||
if (FavourSize) {
|
if (CodeSizeFactor > 180) {
|
||||||
|
ldyconst (offs + 1);
|
||||||
|
AddCodeLine ("\tlda\t(sp),y");
|
||||||
|
AddCodeLine ("\ttax");
|
||||||
|
AddCodeLine ("\tdey");
|
||||||
|
AddCodeLine ("\tlda\t(sp),y");
|
||||||
|
} else {
|
||||||
if (offs) {
|
if (offs) {
|
||||||
ldyconst (offs+1);
|
ldyconst (offs+1);
|
||||||
AddCodeLine ("\tjsr\tldaxysp");
|
AddCodeLine ("\tjsr\tldaxysp");
|
||||||
} else {
|
} else {
|
||||||
AddCodeLine ("\tjsr\tldax0sp");
|
AddCodeLine ("\tjsr\tldax0sp");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ldyconst (offs + 1);
|
|
||||||
AddCodeLine ("\tlda\t(sp),y");
|
|
||||||
AddCodeLine ("\ttax");
|
|
||||||
AddCodeLine ("\tdey");
|
|
||||||
AddCodeLine ("\tlda\t(sp),y");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -878,13 +878,13 @@ void g_getind (unsigned flags, unsigned offs)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (flags & CF_UNSIGNED) {
|
if (flags & CF_UNSIGNED) {
|
||||||
if (FavourSize) {
|
if (CodeSizeFactor > 250) {
|
||||||
AddCodeLine ("\tjsr\tldaui");
|
|
||||||
} else {
|
|
||||||
AddCodeLine ("\tsta\tptr1");
|
AddCodeLine ("\tsta\tptr1");
|
||||||
AddCodeLine ("\tstx\tptr1+1");
|
AddCodeLine ("\tstx\tptr1+1");
|
||||||
AddCodeLine ("\tldx\t#$00");
|
AddCodeLine ("\tldx\t#$00");
|
||||||
AddCodeLine ("\tlda\t(ptr1,x)");
|
AddCodeLine ("\tlda\t(ptr1,x)");
|
||||||
|
} else {
|
||||||
|
AddCodeLine ("\tjsr\tldaui");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AddCodeLine ("\tjsr\tldai");
|
AddCodeLine ("\tjsr\tldai");
|
||||||
@ -941,14 +941,14 @@ void g_leasp (int offs)
|
|||||||
AddCodeLine ("\tlda\tsp");
|
AddCodeLine ("\tlda\tsp");
|
||||||
AddCodeLine ("\tldx\tsp+1");
|
AddCodeLine ("\tldx\tsp+1");
|
||||||
} else {
|
} else {
|
||||||
if (FavourSize) {
|
if (CodeSizeFactor < 300) {
|
||||||
ldaconst (offs); /* Load A with offset value */
|
ldaconst (offs); /* Load A with offset value */
|
||||||
AddCodeLine ("\tjsr\tleaasp"); /* Load effective address */
|
AddCodeLine ("\tjsr\tleaasp"); /* Load effective address */
|
||||||
} else {
|
} else {
|
||||||
if (CPU == CPU_65C02 && offs == 1) {
|
if (CPU == CPU_65C02 && offs == 1) {
|
||||||
AddCodeLine ("\tlda\tsp");
|
AddCodeLine ("\tlda\tsp");
|
||||||
AddCodeLine ("\tldx\tsp+1");
|
AddCodeLine ("\tldx\tsp+1");
|
||||||
AddCodeLine ("\tina");
|
AddCodeLine ("\tina");
|
||||||
AddCodeLine ("\tbne\t*+3");
|
AddCodeLine ("\tbne\t*+3");
|
||||||
AddCodeLine ("\tinx");
|
AddCodeLine ("\tinx");
|
||||||
AddCodeHint ("x:!"); /* Invalidate X */
|
AddCodeHint ("x:!"); /* Invalidate X */
|
||||||
@ -1127,7 +1127,7 @@ void g_putlocal (unsigned Flags, int Offs, long Val)
|
|||||||
AddCodeLine ("\tsta\t(sp),y");
|
AddCodeLine ("\tsta\t(sp),y");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((Flags & CF_NOKEEP) == 0 || FavourSize) {
|
if ((Flags & CF_NOKEEP) == 0 || CodeSizeFactor < 160) {
|
||||||
if (Offs) {
|
if (Offs) {
|
||||||
ldyconst (Offs);
|
ldyconst (Offs);
|
||||||
AddCodeLine ("\tjsr\tstaxysp");
|
AddCodeLine ("\tjsr\tstaxysp");
|
||||||
@ -1315,12 +1315,12 @@ void g_reglong (unsigned flags)
|
|||||||
case CF_CHAR:
|
case CF_CHAR:
|
||||||
case CF_INT:
|
case CF_INT:
|
||||||
if (flags & CF_UNSIGNED) {
|
if (flags & CF_UNSIGNED) {
|
||||||
if (FavourSize) {
|
if (CodeSizeFactor >= 200) {
|
||||||
AddCodeLine ("\tjsr\taxulong");
|
|
||||||
} else {
|
|
||||||
ldyconst (0);
|
ldyconst (0);
|
||||||
AddCodeLine ("\tsty\tsreg");
|
AddCodeLine ("\tsty\tsreg");
|
||||||
AddCodeLine ("\tsty\tsreg+1");
|
AddCodeLine ("\tsty\tsreg+1");
|
||||||
|
} else {
|
||||||
|
AddCodeLine ("\tjsr\taxulong");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AddCodeLine ("\tjsr\taxlong");
|
AddCodeLine ("\tjsr\taxlong");
|
||||||
@ -1451,19 +1451,19 @@ void g_scale (unsigned flags, long val)
|
|||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case CF_INT:
|
case CF_INT:
|
||||||
if (FavourSize || p2 >= 3) {
|
if (CodeSizeFactor >= (p2+1)*130U) {
|
||||||
if (flags & CF_UNSIGNED) {
|
|
||||||
AddCodeLine ("\tjsr\tshlax%d", p2);
|
|
||||||
} else {
|
|
||||||
AddCodeLine ("\tjsr\taslax%d", p2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
AddCodeLine ("\tstx\ttmp1");
|
AddCodeLine ("\tstx\ttmp1");
|
||||||
while (p2--) {
|
while (p2--) {
|
||||||
AddCodeLine ("\tasl\ta");
|
AddCodeLine ("\tasl\ta");
|
||||||
AddCodeLine ("\trol\ttmp1");
|
AddCodeLine ("\trol\ttmp1");
|
||||||
}
|
}
|
||||||
AddCodeLine ("\tldx\ttmp1");
|
AddCodeLine ("\tldx\ttmp1");
|
||||||
|
} else {
|
||||||
|
if (flags & CF_UNSIGNED) {
|
||||||
|
AddCodeLine ("\tjsr\tshlax%d", p2);
|
||||||
|
} else {
|
||||||
|
AddCodeLine ("\tjsr\taslax%d", p2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1513,20 +1513,18 @@ void g_scale (unsigned flags, long val)
|
|||||||
|
|
||||||
case CF_INT:
|
case CF_INT:
|
||||||
if (flags & CF_UNSIGNED) {
|
if (flags & CF_UNSIGNED) {
|
||||||
if (FavourSize || p2 >= 3) {
|
if (CodeSizeFactor >= (p2+1)*130U) {
|
||||||
AddCodeLine ("\tjsr\tlsrax%d", p2);
|
|
||||||
} else {
|
|
||||||
AddCodeLine ("\tstx\ttmp1");
|
AddCodeLine ("\tstx\ttmp1");
|
||||||
while (p2--) {
|
while (p2--) {
|
||||||
AddCodeLine ("\tlsr\ttmp1");
|
AddCodeLine ("\tlsr\ttmp1");
|
||||||
AddCodeLine ("\tror\ta");
|
AddCodeLine ("\tror\ta");
|
||||||
}
|
}
|
||||||
AddCodeLine ("\tldx\ttmp1");
|
AddCodeLine ("\tldx\ttmp1");
|
||||||
|
} else {
|
||||||
|
AddCodeLine ("\tjsr\tlsrax%d", p2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (FavourSize || p2 >= 3) {
|
if (CodeSizeFactor >= (p2+1)*150U) {
|
||||||
AddCodeLine ("\tjsr\tasrax%d", p2);
|
|
||||||
} else {
|
|
||||||
AddCodeLine ("\tstx\ttmp1");
|
AddCodeLine ("\tstx\ttmp1");
|
||||||
while (p2--) {
|
while (p2--) {
|
||||||
AddCodeLine ("\tcpx\t#$80");
|
AddCodeLine ("\tcpx\t#$80");
|
||||||
@ -1534,6 +1532,8 @@ void g_scale (unsigned flags, long val)
|
|||||||
AddCodeLine ("\tror\ta");
|
AddCodeLine ("\tror\ta");
|
||||||
}
|
}
|
||||||
AddCodeLine ("\tldx\ttmp1");
|
AddCodeLine ("\tldx\ttmp1");
|
||||||
|
} else {
|
||||||
|
AddCodeLine ("\tjsr\tasrax%d", p2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1902,7 +1902,7 @@ void g_addeqind (unsigned flags, unsigned offs, unsigned long val)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CF_INT:
|
case CF_INT:
|
||||||
if (!FavourSize) {
|
if (CodeSizeFactor >= 200) {
|
||||||
/* Lots of code, use only if size is not important */
|
/* Lots of code, use only if size is not important */
|
||||||
AddCodeLine ("\tsta\tptr1");
|
AddCodeLine ("\tsta\tptr1");
|
||||||
AddCodeLine ("\tstx\tptr1+1");
|
AddCodeLine ("\tstx\tptr1+1");
|
||||||
@ -2137,7 +2137,7 @@ void g_subeqind (unsigned flags, unsigned offs, unsigned long val)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CF_INT:
|
case CF_INT:
|
||||||
if (!FavourSize) {
|
if (CodeSizeFactor >= 200) {
|
||||||
/* Lots of code, use only if size is not important */
|
/* Lots of code, use only if size is not important */
|
||||||
AddCodeLine ("\tsta\tptr1");
|
AddCodeLine ("\tsta\tptr1");
|
||||||
AddCodeLine ("\tstx\tptr1+1");
|
AddCodeLine ("\tstx\tptr1+1");
|
||||||
@ -2419,11 +2419,11 @@ void g_push (unsigned flags, unsigned long val)
|
|||||||
if ((flags & CF_TYPE) == CF_CHAR && (flags & CF_FORCECHAR)) {
|
if ((flags & CF_TYPE) == CF_CHAR && (flags & CF_FORCECHAR)) {
|
||||||
|
|
||||||
/* Handle as 8 bit value */
|
/* Handle as 8 bit value */
|
||||||
if (FavourSize && val <= 2) {
|
if (CodeSizeFactor >= 165 || val > 2) {
|
||||||
AddCodeLine ("\tjsr\tpushc%d", (int) val);
|
|
||||||
} else {
|
|
||||||
ldaconst (val);
|
ldaconst (val);
|
||||||
AddCodeLine ("\tjsr\tpusha");
|
AddCodeLine ("\tjsr\tpusha");
|
||||||
|
} else {
|
||||||
|
AddCodeLine ("\tjsr\tpushc%d", (int) val);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -3309,7 +3309,7 @@ void g_inc (unsigned flags, unsigned long val)
|
|||||||
AddCodeLine ("\tinx");
|
AddCodeLine ("\tinx");
|
||||||
/* Tell the optimizer that the X register may be invalid */
|
/* Tell the optimizer that the X register may be invalid */
|
||||||
AddCodeHint ("x:!");
|
AddCodeHint ("x:!");
|
||||||
} else if (FavourSize) {
|
} else if (CodeSizeFactor < 200) {
|
||||||
/* Use jsr calls */
|
/* Use jsr calls */
|
||||||
if (val <= 8) {
|
if (val <= 8) {
|
||||||
AddCodeLine ("\tjsr\tincax%lu", val);
|
AddCodeLine ("\tjsr\tincax%lu", val);
|
||||||
@ -3324,24 +3324,24 @@ void g_inc (unsigned flags, unsigned long val)
|
|||||||
if (val < 0x300) {
|
if (val < 0x300) {
|
||||||
if ((val & 0xFF) != 0) {
|
if ((val & 0xFF) != 0) {
|
||||||
AddCodeLine ("\tclc");
|
AddCodeLine ("\tclc");
|
||||||
AddCodeLine ("\tadc\t#$%02X", (unsigned char) val);
|
AddCodeLine ("\tadc\t#$%02X", (unsigned char) val);
|
||||||
AddCodeLine ("\tbcc\t*+3");
|
AddCodeLine ("\tbcc\t*+3");
|
||||||
AddCodeLine ("\tinx");
|
AddCodeLine ("\tinx");
|
||||||
/* Tell the optimizer that the X register may be invalid */
|
/* Tell the optimizer that the X register may be invalid */
|
||||||
AddCodeHint ("x:!");
|
AddCodeHint ("x:!");
|
||||||
}
|
}
|
||||||
if (val >= 0x100) {
|
if (val >= 0x100) {
|
||||||
AddCodeLine ("\tinx");
|
AddCodeLine ("\tinx");
|
||||||
}
|
}
|
||||||
if (val >= 0x200) {
|
if (val >= 0x200) {
|
||||||
AddCodeLine ("\tinx");
|
AddCodeLine ("\tinx");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AddCodeLine ("\tclc");
|
AddCodeLine ("\tclc");
|
||||||
if ((val & 0xFF) != 0) {
|
if ((val & 0xFF) != 0) {
|
||||||
AddCodeLine ("\tadc\t#$%02X", (unsigned char) val);
|
AddCodeLine ("\tadc\t#$%02X", (unsigned char) val);
|
||||||
/* Tell the optimizer that the X register may be invalid */
|
/* Tell the optimizer that the X register may be invalid */
|
||||||
AddCodeHint ("x:!");
|
AddCodeHint ("x:!");
|
||||||
}
|
}
|
||||||
AddCodeLine ("\tpha");
|
AddCodeLine ("\tpha");
|
||||||
AddCodeLine ("\ttxa");
|
AddCodeLine ("\ttxa");
|
||||||
@ -3943,7 +3943,7 @@ void g_strlen (unsigned flags, unsigned long val, unsigned offs)
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Address not constant but in primary */
|
/* Address not constant but in primary */
|
||||||
if (FavourSize) {
|
if (CodeSizeFactor < 400) {
|
||||||
/* This is too much code, so call strlen instead of inlining */
|
/* This is too much code, so call strlen instead of inlining */
|
||||||
AddCodeLine ("\tjsr\t_strlen");
|
AddCodeLine ("\tjsr\t_strlen");
|
||||||
} else {
|
} else {
|
||||||
|
@ -539,7 +539,7 @@ static unsigned FunctionParamList (FuncDesc* Func)
|
|||||||
* - we have more than one parameter to push (don't count the last param
|
* - we have more than one parameter to push (don't count the last param
|
||||||
* for __fastcall__ functions).
|
* for __fastcall__ functions).
|
||||||
*/
|
*/
|
||||||
if (Optimize && !FavourSize) {
|
if (CodeSizeFactor >= 200) {
|
||||||
|
|
||||||
/* Calculate the number and size of the parameters */
|
/* Calculate the number and size of the parameters */
|
||||||
FrameParams = Func->ParamCount;
|
FrameParams = Func->ParamCount;
|
||||||
|
@ -48,6 +48,7 @@ unsigned char WriteableStrings = 0; /* Literal strings are r/w */
|
|||||||
unsigned char NoWarn = 0; /* Suppress warnings */
|
unsigned char NoWarn = 0; /* Suppress warnings */
|
||||||
unsigned char Optimize = 0; /* Optimize flag */
|
unsigned char Optimize = 0; /* Optimize flag */
|
||||||
unsigned char FavourSize = 1; /* Favour size over speed */
|
unsigned char FavourSize = 1; /* Favour size over speed */
|
||||||
|
unsigned CodeSizeFactor = 100; /* Size factor for generated code */
|
||||||
unsigned char InlineStdFuncs = 0; /* Inline some known functions */
|
unsigned char InlineStdFuncs = 0; /* Inline some known functions */
|
||||||
unsigned char EnableRegVars = 0; /* Enable register variables */
|
unsigned char EnableRegVars = 0; /* Enable register variables */
|
||||||
unsigned char AllowRegVarAddr = 0; /* Allow taking addresses of register vars */
|
unsigned char AllowRegVarAddr = 0; /* Allow taking addresses of register vars */
|
||||||
|
@ -49,6 +49,7 @@ extern unsigned char WriteableStrings; /* Literal strings are r/w */
|
|||||||
extern unsigned char NoWarn; /* Suppress warnings */
|
extern unsigned char NoWarn; /* Suppress warnings */
|
||||||
extern unsigned char Optimize; /* Optimize flag */
|
extern unsigned char Optimize; /* Optimize flag */
|
||||||
extern unsigned char FavourSize; /* Favour size over speed */
|
extern unsigned char FavourSize; /* Favour size over speed */
|
||||||
|
extern unsigned CodeSizeFactor; /* Size factor for generated code */
|
||||||
extern unsigned char InlineStdFuncs; /* Inline some known functions */
|
extern unsigned char InlineStdFuncs; /* Inline some known functions */
|
||||||
extern unsigned char EnableRegVars; /* Enable register variables */
|
extern unsigned char EnableRegVars; /* Enable register variables */
|
||||||
extern unsigned char AllowRegVarAddr; /* Allow taking addresses of register vars */
|
extern unsigned char AllowRegVarAddr; /* Allow taking addresses of register vars */
|
||||||
@ -62,6 +63,7 @@ extern unsigned char CreateDep; /* Create a dependency file */
|
|||||||
extern unsigned char CheckStack; /* Generate stack overflow checks */
|
extern unsigned char CheckStack; /* Generate stack overflow checks */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of global.h */
|
/* End of global.h */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,6 +99,7 @@ static void Usage (void)
|
|||||||
" --bss-name seg\tSet the name of the BSS segment\n"
|
" --bss-name seg\tSet the name of the BSS segment\n"
|
||||||
" --check-stack\t\tGenerate stack overflow checks\n"
|
" --check-stack\t\tGenerate stack overflow checks\n"
|
||||||
" --code-name seg\tSet the name of the CODE segment\n"
|
" --code-name seg\tSet the name of the CODE segment\n"
|
||||||
|
" --codesize x\tAccept larger code by factor x\n"
|
||||||
" --cpu type\t\tSet cpu type\n"
|
" --cpu type\t\tSet cpu type\n"
|
||||||
" --data-name seg\tSet the name of the DATA segment\n"
|
" --data-name seg\tSet the name of the DATA segment\n"
|
||||||
" --debug\t\tDebug mode\n"
|
" --debug\t\tDebug mode\n"
|
||||||
@ -314,6 +315,19 @@ static void OptCodeName (const char* Opt, const char* Arg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void OptCodeSize (const char* Opt, const char* Arg)
|
||||||
|
/* Handle the --codesize option */
|
||||||
|
{
|
||||||
|
/* Numeric argument expected */
|
||||||
|
if (sscanf (Arg, "%u", &CodeSizeFactor) != 1 ||
|
||||||
|
CodeSizeFactor < 100 ||
|
||||||
|
CodeSizeFactor > 1000) {
|
||||||
|
AbEnd ("Argument for %s is invalid", Opt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OptCreateDep (const char* Opt, const char* Arg)
|
static void OptCreateDep (const char* Opt, const char* Arg)
|
||||||
/* Handle the --create-dep option */
|
/* Handle the --create-dep option */
|
||||||
{
|
{
|
||||||
@ -439,24 +453,25 @@ int main (int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
/* Program long options */
|
/* Program long options */
|
||||||
static const LongOpt OptTab[] = {
|
static const LongOpt OptTab[] = {
|
||||||
{ "--add-source", 0, OptAddSource },
|
{ "--add-source", 0, OptAddSource },
|
||||||
{ "--ansi", 0, OptAnsi },
|
{ "--ansi", 0, OptAnsi },
|
||||||
{ "--bss-name", 1, OptBssName },
|
{ "--bss-name", 1, OptBssName },
|
||||||
{ "--check-stack", 0, OptCheckStack },
|
{ "--check-stack", 0, OptCheckStack },
|
||||||
{ "--code-name", 1, OptCodeName },
|
{ "--code-name", 1, OptCodeName },
|
||||||
{ "--create-dep", 0, OptCreateDep },
|
{ "--codesize", 1, OptCodeSize },
|
||||||
{ "--cpu", 1, OptCPU },
|
{ "--create-dep", 0, OptCreateDep },
|
||||||
{ "--data-name", 1, OptDataName },
|
{ "--cpu", 1, OptCPU },
|
||||||
{ "--debug", 0, OptDebug },
|
{ "--data-name", 1, OptDataName },
|
||||||
{ "--debug-info", 0, OptDebugInfo },
|
{ "--debug", 0, OptDebug },
|
||||||
{ "--help", 0, OptHelp },
|
{ "--debug-info", 0, OptDebugInfo },
|
||||||
|
{ "--help", 0, OptHelp },
|
||||||
{ "--include-dir", 1, OptIncludeDir },
|
{ "--include-dir", 1, OptIncludeDir },
|
||||||
{ "--rodata-name", 1, OptRodataName },
|
{ "--rodata-name", 1, OptRodataName },
|
||||||
{ "--signed-chars", 0, OptSignedChars },
|
{ "--signed-chars", 0, OptSignedChars },
|
||||||
{ "--static-locals", 0, OptStaticLocals },
|
{ "--static-locals", 0, OptStaticLocals },
|
||||||
{ "--target", 1, OptTarget },
|
{ "--target", 1, OptTarget },
|
||||||
{ "--verbose", 0, OptVerbose },
|
{ "--verbose", 0, OptVerbose },
|
||||||
{ "--version", 0, OptVersion },
|
{ "--version", 0, OptVersion },
|
||||||
};
|
};
|
||||||
|
|
||||||
int I;
|
int I;
|
||||||
@ -558,6 +573,7 @@ int main (int argc, char* argv[])
|
|||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
FavourSize = 0;
|
FavourSize = 0;
|
||||||
|
CodeSizeFactor = 200;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
EnableRegVars = 1;
|
EnableRegVars = 1;
|
||||||
|
@ -568,7 +568,7 @@ static void doswitch (void)
|
|||||||
ConsumeLCurly ();
|
ConsumeLCurly ();
|
||||||
|
|
||||||
/* Now decide which sort of switch we will create: */
|
/* Now decide which sort of switch we will create: */
|
||||||
if (IsTypeChar (eval.e_tptr) || (FavourSize == 0 && IsClassInt (eval.e_tptr))) {
|
if (IsTypeChar (eval.e_tptr) || (CodeSizeFactor >= 200 && IsClassInt (eval.e_tptr))) {
|
||||||
cascadeswitch (&eval);
|
cascadeswitch (&eval);
|
||||||
} else {
|
} else {
|
||||||
tableswitch (&eval);
|
tableswitch (&eval);
|
||||||
|
Loading…
Reference in New Issue
Block a user