-/* 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 */
F->Reserved = 0;
F->RetLab = GetLocalLabel ();
F->TopLevelSP = 0;
- F->RegOffs = MAX_REG_SPACE;
+ F->RegOffs = RegisterSpace;
/* Return the new structure */
return 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;
}
/* */
/* */
/* */
-/* (C) 1998-2001 Ullrich von Bassewitz */
+/* (C) 1998-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
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 */
/* */
/* */
/* */
-/* (C) 1998-2001 Ullrich von Bassewitz */
+/* (C) 1998-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@cc65.org */
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 */
" --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"
-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 */
{
{ "--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 },