1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Improved code generation

git-svn-id: svn://svn.cc65.org/cc65/trunk@3072 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-06-03 12:08:49 +00:00
parent 01104d26ea
commit 2fa9b6e5ac
2 changed files with 11 additions and 7 deletions

View File

@ -1247,7 +1247,7 @@ static void StructRef (ExprDesc* Expr)
return; return;
} }
/* If we have a struct pointer that is an lvalue and not already in the /* If we have a struct pointer that is an lvalue and not already in the
* primary, load it now. * primary, load it now.
*/ */
if (ED_IsLVal (Expr) && IsTypePtr (Expr->Type)) { if (ED_IsLVal (Expr) && IsTypePtr (Expr->Type)) {
@ -1676,10 +1676,14 @@ void hie10 (ExprDesc* Expr)
case TOK_STAR: case TOK_STAR:
NextToken (); NextToken ();
if (evalexpr (CF_NONE, hie10, Expr) != 0) { ExprWithCheck (hie10, Expr);
/* Expression is not const, indirect value loaded into primary */ if (ED_IsLVal (Expr) || !(ED_IsLocConst (Expr) || ED_IsLocStack (Expr)))) {
ED_MakeRValExpr (Expr); /* Not a const, load it into the primary and make it a
} * calculated value.
*/
ExprLoad (CF_NONE, Expr);
ED_MakeRValExpr (Expr);
}
/* If the expression is already a pointer to function, the /* If the expression is already a pointer to function, the
* additional dereferencing operator must be ignored. * additional dereferencing operator must be ignored.
*/ */
@ -1698,7 +1702,7 @@ void hie10 (ExprDesc* Expr)
case TOK_AND: case TOK_AND:
NextToken (); NextToken ();
hie10 (Expr); ExprWithCheck (hie10, Expr);
/* The & operator may be applied to any lvalue, and it may be /* The & operator may be applied to any lvalue, and it may be
* applied to functions, even if they're no lvalues. * applied to functions, even if they're no lvalues.
*/ */

View File

@ -197,7 +197,7 @@ int ED_IsConstAbs (const ExprDesc* Expr)
* a numeric constant, cast to any type. * a numeric constant, cast to any type.
*/ */
{ {
return ED_IsConst (Expr) && ED_IsLocAbs (Expr); return (Expr->Flags & (E_MASK_LOC|E_MASK_RTYPE)) == (E_LOC_ABS|E_RTYPE_RVAL);
} }