Added some code to handle floats/doubles.
Fixed code generation for compares. git-svn-id: svn://svn.cc65.org/cc65/trunk@2488 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -272,6 +272,9 @@ unsigned sizeofarg (unsigned flags)
|
|||||||
case CF_LONG:
|
case CF_LONG:
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
|
case CF_FLOAT:
|
||||||
|
return 4;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
typeerror (flags);
|
typeerror (flags);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
@@ -3385,19 +3388,19 @@ void g_eq (unsigned flags, unsigned long val)
|
|||||||
switch (flags & CF_TYPE) {
|
switch (flags & CF_TYPE) {
|
||||||
|
|
||||||
case CF_CHAR:
|
case CF_CHAR:
|
||||||
if (flags & CF_FORCECHAR) {
|
if (flags & CF_FORCECHAR) {
|
||||||
AddCodeLine ("cmp #$%02X", (unsigned char)val);
|
AddCodeLine ("cmp #$%02X", (unsigned char)val);
|
||||||
AddCodeLine ("jsr booleq");
|
AddCodeLine ("jsr booleq");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case CF_INT:
|
case CF_INT:
|
||||||
L = GetLocalLabel();
|
L = GetLocalLabel();
|
||||||
AddCodeLine ("cpx #$%02X", (unsigned char)(val >> 8));
|
AddCodeLine ("cpx #$%02X", (unsigned char)(val >> 8));
|
||||||
AddCodeLine ("bne %s", LocalLabelName (L));
|
AddCodeLine ("bne %s", LocalLabelName (L));
|
||||||
AddCodeLine ("cmp #$%02X", (unsigned char)val);
|
AddCodeLine ("cmp #$%02X", (unsigned char)val);
|
||||||
g_defcodelabel (L);
|
g_defcodelabel (L);
|
||||||
AddCodeLine ("jsr booleq");
|
AddCodeLine ("jsr booleq");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -3409,10 +3412,11 @@ void g_eq (unsigned flags, unsigned long val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
||||||
* into the normal, non-optimized stuff.
|
* into the normal, non-optimized stuff. Note: The standard stuff will
|
||||||
|
* always work with ints.
|
||||||
*/
|
*/
|
||||||
g_push (flags & ~CF_CONST, 0);
|
flags &= ~CF_FORCECHAR;
|
||||||
|
g_push (flags & ~CF_CONST, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use long way over the stack */
|
/* Use long way over the stack */
|
||||||
@@ -3465,10 +3469,11 @@ void g_ne (unsigned flags, unsigned long val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
||||||
* into the normal, non-optimized stuff.
|
* into the normal, non-optimized stuff. Note: The standard stuff will
|
||||||
|
* always work with ints.
|
||||||
*/
|
*/
|
||||||
g_push (flags & ~CF_CONST, 0);
|
flags &= ~CF_FORCECHAR;
|
||||||
|
g_push (flags & ~CF_CONST, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use long way over the stack */
|
/* Use long way over the stack */
|
||||||
@@ -3545,11 +3550,12 @@ void g_lt (unsigned flags, unsigned long val)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
||||||
* into the normal, non-optimized stuff.
|
* into the normal, non-optimized stuff. Note: The standard stuff will
|
||||||
*/
|
* always work with ints.
|
||||||
g_push (flags & ~CF_CONST, 0);
|
*/
|
||||||
|
flags &= ~CF_FORCECHAR;
|
||||||
|
g_push (flags & ~CF_CONST, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use long way over the stack */
|
/* Use long way over the stack */
|
||||||
@@ -3663,10 +3669,11 @@ void g_le (unsigned flags, unsigned long val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
||||||
* into the normal, non-optimized stuff.
|
* into the normal, non-optimized stuff. Note: The standard stuff will
|
||||||
|
* always work with ints.
|
||||||
*/
|
*/
|
||||||
g_push (flags & ~CF_CONST, 0);
|
flags &= ~CF_FORCECHAR;
|
||||||
|
g_push (flags & ~CF_CONST, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use long way over the stack */
|
/* Use long way over the stack */
|
||||||
@@ -3796,10 +3803,11 @@ void g_gt (unsigned flags, unsigned long val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
||||||
* into the normal, non-optimized stuff.
|
* into the normal, non-optimized stuff. Note: The standard stuff will
|
||||||
|
* always work with ints.
|
||||||
*/
|
*/
|
||||||
g_push (flags & ~CF_CONST, 0);
|
flags &= ~CF_FORCECHAR;
|
||||||
|
g_push (flags & ~CF_CONST, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use long way over the stack */
|
/* Use long way over the stack */
|
||||||
@@ -3877,11 +3885,12 @@ void g_ge (unsigned flags, unsigned long val)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
/* If we go here, we didn't emit code. Push the lhs on stack and fall
|
||||||
* into the normal, non-optimized stuff.
|
* into the normal, non-optimized stuff. Note: The standard stuff will
|
||||||
*/
|
* always work with ints.
|
||||||
g_push (flags & ~CF_CONST, 0);
|
*/
|
||||||
|
flags &= ~CF_FORCECHAR;
|
||||||
|
g_push (flags & ~CF_CONST, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use long way over the stack */
|
/* Use long way over the stack */
|
||||||
|
|||||||
Reference in New Issue
Block a user