mirror of
https://github.com/cc65/cc65.git
synced 2025-01-26 17:36:57 +00:00
Added integer boolean type string.
No longer set the "expression tested" flag with constant results in comparison.
This commit is contained in:
parent
c3a6b39945
commit
17bbba7327
@ -66,6 +66,7 @@ Type type_int[] = { TYPE(T_INT), TYPE(T_END) };
|
||||
Type type_uint[] = { TYPE(T_UINT), TYPE(T_END) };
|
||||
Type type_long[] = { TYPE(T_LONG), TYPE(T_END) };
|
||||
Type type_ulong[] = { TYPE(T_ULONG), TYPE(T_END) };
|
||||
Type type_bool[] = { TYPE(T_INT), TYPE(T_END) };
|
||||
Type type_void[] = { TYPE(T_VOID), TYPE(T_END) };
|
||||
Type type_size_t[] = { TYPE(T_SIZE_T), TYPE(T_END) };
|
||||
Type type_float[] = { TYPE(T_FLOAT), TYPE(T_END) };
|
||||
|
@ -196,6 +196,7 @@ extern Type type_int[];
|
||||
extern Type type_uint[];
|
||||
extern Type type_long[];
|
||||
extern Type type_ulong[];
|
||||
extern Type type_bool[];
|
||||
extern Type type_void[];
|
||||
extern Type type_size_t[];
|
||||
extern Type type_float[];
|
||||
|
@ -2595,13 +2595,13 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
||||
|
||||
/* The result is an rvalue in the primary */
|
||||
ED_FinalizeRValLoad (Expr);
|
||||
|
||||
/* Condition codes are set */
|
||||
ED_TestDone (Expr);
|
||||
}
|
||||
|
||||
/* Result type is always int */
|
||||
Expr->Type = type_int;
|
||||
|
||||
Done: /* Condition codes are set */
|
||||
ED_TestDone (Expr);
|
||||
/* Result type is always boolean */
|
||||
Done: Expr->Type = type_bool;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,6 +229,20 @@ ExprDesc* ED_MakeConstAbsInt (ExprDesc* Expr, long Value)
|
||||
|
||||
|
||||
|
||||
ExprDesc* ED_MakeConstBool (ExprDesc* Expr, long Value)
|
||||
/* Replace Expr with a constant boolean expression with the given value */
|
||||
{
|
||||
Expr->Sym = 0;
|
||||
Expr->Type = type_bool;
|
||||
Expr->Flags = E_LOC_NONE | E_RTYPE_RVAL | (Expr->Flags & E_HAVE_MARKS);
|
||||
Expr->Name = 0;
|
||||
Expr->IVal = Value;
|
||||
Expr->FVal = FP_D_Make (0.0);
|
||||
return Expr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ExprDesc* ED_FinalizeRValLoad (ExprDesc* Expr)
|
||||
/* Finalize the result of LoadExpr to be an rvalue in the primary register */
|
||||
{
|
||||
|
@ -411,6 +411,9 @@ ExprDesc* ED_MakeConstAbs (ExprDesc* Expr, long Value, Type* Type);
|
||||
ExprDesc* ED_MakeConstAbsInt (ExprDesc* Expr, long Value);
|
||||
/* Replace Expr with an constant integer with the given value */
|
||||
|
||||
ExprDesc* ED_MakeConstBool (ExprDesc* Expr, long Value);
|
||||
/* Replace Expr with a constant boolean expression with the given value */
|
||||
|
||||
ExprDesc* ED_FinalizeRValLoad (ExprDesc* Expr);
|
||||
/* Finalize the result of LoadExpr to be an rvalue in the primary register */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user