1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 22:30:12 +00:00

New --register-space option

git-svn-id: svn://svn.cc65.org/cc65/trunk@1653 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-11-26 18:27:09 +00:00
parent bf5ae8b663
commit 0348739164
4 changed files with 20 additions and 8 deletions

View File

@ -60,9 +60,6 @@
/* Maximum register variable size */
#define MAX_REG_SPACE 6
/* Structure that holds all data needed for function activation */
struct Function {
struct SymEntry* FuncEntry; /* Symbol table entry */
@ -98,7 +95,7 @@ static Function* NewFunction (struct SymEntry* Sym)
F->Reserved = 0;
F->RetLab = GetLocalLabel ();
F->TopLevelSP = 0;
F->RegOffs = MAX_REG_SPACE;
F->RegOffs = RegisterSpace;
/* Return the new structure */
return F;
@ -260,7 +257,7 @@ static void F_RestoreRegVars (Function* F)
const SymEntry* Sym;
/* If we don't have register variables in this function, bail out early */
if (F->RegOffs == MAX_REG_SPACE) {
if (F->RegOffs == RegisterSpace) {
return;
}

View File

@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2001 Ullrich von Bassewitz */
/* (C) 1998-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
@ -52,6 +52,7 @@ 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 EnableRegVars = 0; /* Enable register variables */
unsigned RegisterSpace = 6; /* Space available for register vars */
unsigned char AllowRegVarAddr = 0; /* Allow taking addresses of register vars */
unsigned char RegVarsToCallStack= 0; /* Save reg variables on call stack */
unsigned char StaticLocals = 0; /* Make local variables static */

View File

@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2001 Ullrich von Bassewitz */
/* (C) 1998-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
@ -53,6 +53,7 @@ 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 EnableRegVars; /* Enable register variables */
extern unsigned RegisterSpace; /* Space available for register vars */
extern unsigned char AllowRegVarAddr; /* Allow taking addresses of register vars */
extern unsigned char RegVarsToCallStack; /* Save reg variables on call stack */
extern unsigned char StaticLocals; /* Make local variables static */

View File

@ -113,6 +113,7 @@ static void Usage (void)
" --help\t\tHelp (this text)\n"
" --include-dir dir\tSet an include directory search path\n"
" --list-opt-steps\tList all optimizer steps and exit\n"
" --register-space b\tSet space available for register variables\n"
" --register-vars\tEnable register variables\n"
" --rodata-name seg\tSet the name of the RODATA segment\n"
" --signed-chars\tDefault characters are signed\n"
@ -530,7 +531,18 @@ static void OptListOptSteps (const char* Opt attribute ((unused)),
static void OptRegisterVars (const char* Opt attribute ((unused)),
static void OptRegisterSpace (const char* Opt, const char* Arg)
/* Handle the --register-space option */
{
/* Numeric argument expected */
if (sscanf (Arg, "%u", &RegisterSpace) != 1 || RegisterSpace > 256) {
AbEnd ("Argument for option %s is invalid", Opt);
}
}
static void OptRegisterVars (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Handle the --register-vars option */
{
@ -618,6 +630,7 @@ int main (int argc, char* argv[])
{ "--help", 0, OptHelp },
{ "--include-dir", 1, OptIncludeDir },
{ "--list-opt-steps", 0, OptListOptSteps },
{ "--register-space", 1, OptRegisterSpace },
{ "--register-vars", 0, OptRegisterVars },
{ "--rodata-name", 1, OptRodataName },
{ "--signed-chars", 0, OptSignedChars },