More compiler flags on address types to match the location types of expressions.
This commit is contained in:
parent
2108489523
commit
d23b577331
3 changed files with 33 additions and 30 deletions
|
@ -1349,7 +1349,7 @@ unsigned g_typeadjust (unsigned lhs, unsigned rhs)
|
||||||
rtype = CF_LONG;
|
rtype = CF_LONG;
|
||||||
} else if (ltype != CF_LONG && (lhs & CF_CONST) == 0 && rtype == CF_LONG) {
|
} else if (ltype != CF_LONG && (lhs & CF_CONST) == 0 && rtype == CF_LONG) {
|
||||||
/* We must promote the lhs to long */
|
/* We must promote the lhs to long */
|
||||||
if (lhs & CF_REG) {
|
if (lhs & CF_PRIMARY) {
|
||||||
g_reglong (lhs);
|
g_reglong (lhs);
|
||||||
} else {
|
} else {
|
||||||
g_toslong (lhs);
|
g_toslong (lhs);
|
||||||
|
@ -2338,7 +2338,7 @@ void g_call (unsigned Flags, const char* Label, unsigned ArgSize)
|
||||||
void g_callind (unsigned Flags, unsigned ArgSize, int Offs)
|
void g_callind (unsigned Flags, unsigned ArgSize, int Offs)
|
||||||
/* Call subroutine indirect */
|
/* Call subroutine indirect */
|
||||||
{
|
{
|
||||||
if ((Flags & CF_LOCAL) == 0) {
|
if ((Flags & CF_STACK) == 0) {
|
||||||
/* Address is in a/x */
|
/* Address is in a/x */
|
||||||
if ((Flags & CF_FIXARGC) == 0) {
|
if ((Flags & CF_FIXARGC) == 0) {
|
||||||
/* Pass arg count */
|
/* Pass arg count */
|
||||||
|
|
|
@ -62,35 +62,38 @@
|
||||||
#define CF_NONE 0x0000 /* No special flags */
|
#define CF_NONE 0x0000 /* No special flags */
|
||||||
|
|
||||||
/* Values for the actual type */
|
/* Values for the actual type */
|
||||||
#define CF_CHAR 0x0003 /* Operation on characters */
|
#define CF_CHAR 0x0007 /* Operation on characters */
|
||||||
#define CF_INT 0x0001 /* Operation on ints */
|
#define CF_INT 0x0003 /* Operation on ints */
|
||||||
|
#define CF_SHORT CF_INT /* Alias */
|
||||||
#define CF_PTR CF_INT /* Alias for readability */
|
#define CF_PTR CF_INT /* Alias for readability */
|
||||||
#define CF_LONG 0x0000 /* Operation on longs */
|
#define CF_LONG 0x0001 /* Operation on longs */
|
||||||
#define CF_FLOAT 0x0004 /* Operation on a float */
|
#define CF_FLOAT 0x0010 /* Operation on a float */
|
||||||
|
|
||||||
/* Signedness */
|
/* Signedness */
|
||||||
#define CF_UNSIGNED 0x0008 /* Value is unsigned */
|
#define CF_UNSIGNED 0x0008 /* Value is unsigned */
|
||||||
|
|
||||||
/* Masks for retrieving type information */
|
/* Masks for retrieving type information */
|
||||||
#define CF_TYPEMASK 0x0007 /* Type information */
|
#define CF_TYPEMASK 0x0017 /* Type information */
|
||||||
#define CF_STYPEMASK 0x000F /* Includes signedness */
|
#define CF_STYPEMASK 0x001F /* Includes signedness */
|
||||||
|
|
||||||
#define CF_NOKEEP 0x0010 /* Value may get destroyed when storing */
|
#define CF_CONST 0x0040 /* Constant value available */
|
||||||
#define CF_CONST 0x0020 /* Constant value available */
|
|
||||||
#define CF_CONSTADDR 0x0040 /* Constant address value available */
|
|
||||||
#define CF_TEST 0x0080 /* Test value */
|
#define CF_TEST 0x0080 /* Test value */
|
||||||
#define CF_FIXARGC 0x0100 /* Function has fixed arg count */
|
#define CF_FIXARGC 0x0100 /* Function has fixed arg count */
|
||||||
#define CF_FORCECHAR 0x0200 /* Handle chars as chars, not ints */
|
#define CF_FORCECHAR 0x0200 /* Handle chars as chars, not ints */
|
||||||
|
#define CF_NOKEEP 0x0400 /* Value may get destroyed when storing */
|
||||||
|
|
||||||
/* Type of static address */
|
/* Type of address */
|
||||||
#define CF_ADDRMASK 0xFC00 /* Type of address */
|
#define CF_ADDRMASK 0xF000 /* Bit mask of address type */
|
||||||
#define CF_IMM 0x0000 /* Value is pure rvalue and has no address */
|
#define CF_IMM 0x0000 /* Value is pure rvalue and has no storage */
|
||||||
#define CF_REG 0x0400 /* Value is in primary register */
|
#define CF_ABSOLUTE 0x1000 /* Numeric absolute address */
|
||||||
#define CF_STATIC 0x0800 /* Static local */
|
#define CF_EXTERNAL 0x2000 /* External */
|
||||||
#define CF_EXTERNAL 0x1000 /* Static external */
|
#define CF_REGVAR 0x4000 /* Register variable */
|
||||||
#define CF_ABSOLUTE 0x2000 /* Numeric absolute address */
|
#define CF_LITERAL 0x7000 /* Literal */
|
||||||
#define CF_LOCAL 0x4000 /* Auto variable */
|
#define CF_PRIMARY 0x8000 /* Value is in primary register */
|
||||||
#define CF_REGVAR 0x8000 /* Register variable */
|
#define CF_EXPR 0x9000 /* Value is addressed by primary register */
|
||||||
|
#define CF_STATIC 0xA000 /* Local static */
|
||||||
|
#define CF_CODE 0xB000 /* C code label location */
|
||||||
|
#define CF_STACK 0xC000 /* Function-local auto on stack */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,10 @@ static unsigned GlobalModeFlags (const ExprDesc* Expr)
|
||||||
case E_LOC_GLOBAL: return CF_EXTERNAL;
|
case E_LOC_GLOBAL: return CF_EXTERNAL;
|
||||||
case E_LOC_STATIC: return CF_STATIC;
|
case E_LOC_STATIC: return CF_STATIC;
|
||||||
case E_LOC_REGISTER: return CF_REGVAR;
|
case E_LOC_REGISTER: return CF_REGVAR;
|
||||||
case E_LOC_STACK: return CF_NONE;
|
case E_LOC_STACK: return CF_STACK;
|
||||||
case E_LOC_PRIMARY: return CF_NONE;
|
case E_LOC_PRIMARY: return CF_PRIMARY;
|
||||||
case E_LOC_EXPR: return CF_NONE;
|
case E_LOC_EXPR: return CF_EXPR;
|
||||||
case E_LOC_LITERAL: return CF_STATIC; /* Same as static */
|
case E_LOC_LITERAL: return CF_LITERAL;
|
||||||
default:
|
default:
|
||||||
Internal ("GlobalModeFlags: Invalid location flags value: 0x%04X", Expr->Flags);
|
Internal ("GlobalModeFlags: Invalid location flags value: 0x%04X", Expr->Flags);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
@ -189,7 +189,7 @@ static unsigned typeadjust (ExprDesc* lhs, ExprDesc* rhs, int NoPush)
|
||||||
}
|
}
|
||||||
if (NoPush) {
|
if (NoPush) {
|
||||||
/* Value is in primary register*/
|
/* Value is in primary register*/
|
||||||
ltype |= CF_REG;
|
ltype |= CF_PRIMARY;
|
||||||
}
|
}
|
||||||
rtype = TypeOf (rhst);
|
rtype = TypeOf (rhst);
|
||||||
if (ED_IsLocNone (rhs)) {
|
if (ED_IsLocNone (rhs)) {
|
||||||
|
@ -587,7 +587,7 @@ static void FunctionCall (ExprDesc* Expr)
|
||||||
** Since fastcall functions may never be variadic, we can use the
|
** Since fastcall functions may never be variadic, we can use the
|
||||||
** index register for this purpose.
|
** index register for this purpose.
|
||||||
*/
|
*/
|
||||||
g_callind (CF_LOCAL, ParamSize, PtrOffs);
|
g_callind (CF_STACK, ParamSize, PtrOffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have a pointer on stack, remove it */
|
/* If we have a pointer on stack, remove it */
|
||||||
|
@ -2068,7 +2068,7 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */
|
||||||
if ((Gen->Flags & GEN_NOPUSH) == 0) {
|
if ((Gen->Flags & GEN_NOPUSH) == 0) {
|
||||||
g_push (ltype, 0);
|
g_push (ltype, 0);
|
||||||
} else {
|
} else {
|
||||||
ltype |= CF_REG; /* Value is in register */
|
ltype |= CF_PRIMARY; /* Value is in register */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the type of the operation result. */
|
/* Determine the type of the operation result. */
|
||||||
|
@ -2100,7 +2100,7 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */
|
||||||
}
|
}
|
||||||
if ((Gen->Flags & GEN_NOPUSH) != 0) {
|
if ((Gen->Flags & GEN_NOPUSH) != 0) {
|
||||||
RemoveCode (&Mark2);
|
RemoveCode (&Mark2);
|
||||||
ltype |= CF_REG; /* Value is in register */
|
ltype |= CF_PRIMARY; /* Value is in register */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2276,7 +2276,7 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
||||||
flags |= CF_CONST;
|
flags |= CF_CONST;
|
||||||
if ((Gen->Flags & GEN_NOPUSH) != 0) {
|
if ((Gen->Flags & GEN_NOPUSH) != 0) {
|
||||||
RemoveCode (&Mark2);
|
RemoveCode (&Mark2);
|
||||||
ltype |= CF_REG; /* Value is in register */
|
ltype |= CF_PRIMARY; /* Value is in register */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2550,7 +2550,7 @@ static void parseadd (ExprDesc* Expr)
|
||||||
flags |= CF_CONST;
|
flags |= CF_CONST;
|
||||||
} else {
|
} else {
|
||||||
/* Constant address label */
|
/* Constant address label */
|
||||||
flags |= GlobalModeFlags (Expr) | CF_CONSTADDR;
|
flags |= GlobalModeFlags (Expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for pointer arithmetic */
|
/* Check for pointer arithmetic */
|
||||||
|
|
Loading…
Add table
Reference in a new issue