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

some logging

This commit is contained in:
mrdudz 2023-08-30 23:49:00 +02:00
parent a77de923fc
commit 00824427f7
3 changed files with 20 additions and 3 deletions

View File

@ -454,7 +454,7 @@ static void OpAssignArithmetic (const GenDesc* Gen, ExprDesc* Expr, const char*
unsigned Flags;
int MustScale;
LOG(("OpAssignArithmetic (Gen=%d)\n", (int)Gen));
LOG(("OpAssignArithmetic '%s' (Gen=%d)\n", Op, (int)Gen));
ED_Init (&Expr2);
Expr2.Flags |= Expr->Flags & E_MASK_KEEP_SUBEXPR;
@ -484,11 +484,11 @@ static void OpAssignArithmetic (const GenDesc* Gen, ExprDesc* Expr, const char*
/* If necessary, load the value into the primary register */
LoadExpr (CF_NONE, &Expr2);
LOG(("OpAssignArithmetic (0) 2 lhs: %s rhs: %s\n",
LOG(("OpAssignArithmetic '%s' (0) 2 lhs: %s rhs: %s\n",
Op,
(TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "int",
(TypeOf (Expr2.Type) == CF_FLOAT) ? "float" : "int"));
} else {
/* Load the original value if necessary */
LoadExpr (CF_NONE, Expr);
@ -735,7 +735,10 @@ void OpAddSubAssign (const GenDesc* Gen, ExprDesc *Expr, const char* Op)
lflags |= TypeOf (Expr->Type) | GlobalModeFlags (Expr) | CF_FORCECHAR;
rflags |= TypeOf (Expr2.Type) | CF_FORCECHAR;
LOG(("OpAddSubAssign '%s' lflags:%04x rflags:%04x\n", Op, lflags, rflags));
if (ED_IsConstAbs (&Expr2)) {
LOG(("OpAddSubAssign '%s' result is constant\n", Op));
/* The resulting value is a constant */
rflags |= CF_CONST;
lflags |= CF_CONST;
@ -745,6 +748,7 @@ void OpAddSubAssign (const GenDesc* Gen, ExprDesc *Expr, const char* Op)
Expr2.IVal *= CheckedSizeOf (Indirect (Expr->Type));
}
} else {
LOG(("OpAddSubAssign '%s' result is not constant\n", Op));
/* Not constant, load into the primary */
LoadExpr (CF_NONE, &Expr2);

View File

@ -832,6 +832,9 @@ void g_getstatic (unsigned flags, uintptr_t label, long offs)
/* Create the correct label name */
const char* lbuf = GetLabelName (flags, label, offs);
LOG(("g_getstatic flags:%04x offs:%04x label:%04x\n", flags, offs, label));
ASMLOG(("nop ; g_getstatic flags:%04x offs:%04x label:%04x\n", flags, offs, label));
/* Check the size and generate the correct load operation */
switch (flags & CF_TYPEMASK) {
@ -1898,6 +1901,10 @@ void g_addeqstatic (unsigned flags, uintptr_t label, long offs,
/* Create the correct label name */
const char* lbuf = GetLabelName (flags, label, offs);
LOG(("g_addeqstatic flags:%04x val:%08x\n", flags, val));
ASMLOG(("nop ; g_addeqstatic val:%08x\n", val));
/* if flags contain CF_CONST, then val contains the constant value */
/* Check the size and determine operation */
switch (flags & CF_TYPEMASK) {
@ -2135,6 +2142,7 @@ void g_subeqstatic (unsigned flags, uintptr_t label, long offs,
/* Create the correct label name */
const char* lbuf = GetLabelName (flags, label, offs);
ASMLOG(("nop ; g_subeqstatic val:%08x\n", val));
/* Check the size and determine operation */
switch (flags & CF_TYPEMASK) {
@ -3847,6 +3855,8 @@ void g_inc (unsigned flags, unsigned long val)
*/
{
LOG(("g_inc flags:%04x val:%08lx\n", flags, val));
ASMLOG(("nop ; g_inc flags:%04x val:%08x", flags, val));
/* Don't inc by zero */
if (val == 0) {
return;
@ -3937,6 +3947,7 @@ void g_inc (unsigned flags, unsigned long val)
/* FIXME: float */
case CF_FLOAT:
ASMLOG(("nop ; g_inc float"));
g_add (flags | CF_CONST, val);
break;

View File

@ -498,6 +498,8 @@ static void DoInc (ExprDesc* Expr, unsigned KeepResult)
/* Get the increment value in bytes */
Val = IsTypePtr (Expr->Type) ? CheckedSizeOf (Expr->Type + 1) : 1;
LOG(("DoInc Val:%d KeepResult:%d\n", Val, KeepResult));
/* Special treatment is needed for bit-fields */
if (IsTypeFragBitField (Expr->Type)) {
DoIncDecBitField (Expr, Val, KeepResult);