1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-17 00:29:31 +00:00

Pass a complete ExprDesc and not just the Flags field to GlobalModeFlags to

allow for better debugging (output) in case of problems.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3879 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2008-08-05 21:11:26 +00:00
parent ac895ef921
commit 9127774a4d

View File

@ -76,15 +76,15 @@ static GenDesc GenOASGN = { TOK_OR_ASSIGN, GEN_NOPUSH, g_or };
static unsigned GlobalModeFlags (unsigned Flags)
/* Return the addressing mode flags for the variable with the given flags */
static unsigned GlobalModeFlags (const ExprDesc* Expr)
/* Return the addressing mode flags for the given expression */
{
switch (Flags & E_MASK_LOC) {
switch (ED_GetLoc (Expr)) {
case E_LOC_GLOBAL: return CF_EXTERNAL;
case E_LOC_STATIC: return CF_STATIC;
case E_LOC_REGISTER: return CF_REGVAR;
default:
Internal ("GlobalModeFlags: Invalid flags value: %u", Flags);
Internal ("GlobalModeFlags: Invalid location flags value: 0x%04X", Expr->Flags);
/* NOTREACHED */
return 0;
}
@ -975,7 +975,7 @@ static void ArrayRef (ExprDesc* Expr)
if (ED_IsLocStack (&SubScript)) {
g_addlocal (Flags, SubScript.IVal);
} else {
Flags |= GlobalModeFlags (SubScript.Flags);
Flags |= GlobalModeFlags (&SubScript);
g_addstatic (Flags, SubScript.Name, SubScript.IVal);
}
} else {
@ -992,7 +992,7 @@ static void ArrayRef (ExprDesc* Expr)
}
} else {
/* Base address is a static variable address */
unsigned Flags = CF_INT | GlobalModeFlags (Expr->Flags);
unsigned Flags = CF_INT | GlobalModeFlags (Expr);
if (ED_IsRVal (Expr)) {
/* Add the address of the location */
g_addaddr_static (Flags, Expr->Name, Expr->IVal);
@ -1982,7 +1982,7 @@ static void parseadd (ExprDesc* Expr)
flags |= CF_CONST;
} else {
/* Constant address label */
flags |= GlobalModeFlags (Expr->Flags) | CF_CONSTADDR;
flags |= GlobalModeFlags (Expr) | CF_CONSTADDR;
}
/* Check for pointer arithmetic */