mirror of
https://github.com/irmen/prog8.git
synced 2024-10-25 00:24:16 +00:00
temporary workaround for code problem around 'not'
This commit is contained in:
parent
2eb41a8caf
commit
8e36fe6bef
@ -150,10 +150,10 @@ class AstPreprocessor(val program: Program, val errors: IErrorReporter, val comp
|
|||||||
private fun wrapWithBooleanConversion(expr: Expression): Expression {
|
private fun wrapWithBooleanConversion(expr: Expression): Expression {
|
||||||
return if(expr is IFunctionCall && expr.target.nameInSource==listOf("boolean"))
|
return if(expr is IFunctionCall && expr.target.nameInSource==listOf("boolean"))
|
||||||
expr
|
expr
|
||||||
else if(expr is BinaryExpression && expr.operator in LogicalOperators+ComparisonOperators-"not") // TODO should work for 'not' too but now causes assembler to generate wrong code
|
else if(expr is BinaryExpression && expr.operator in LogicalOperators+ComparisonOperators)
|
||||||
expr
|
|
||||||
else if(expr is PrefixExpression && expr.operator in LogicalOperators-"not") // TODO should work for 'not' too but now causes assembler to generate wrong code
|
|
||||||
expr
|
expr
|
||||||
|
// else if(expr is PrefixExpression && expr.operator == "not") // TODO should work for 'not' too but now causes assembler to generate wrong code (even without optimizations)
|
||||||
|
// expr
|
||||||
else
|
else
|
||||||
FunctionCallExpression(IdentifierReference(listOf("boolean"), expr.position), mutableListOf(expr), expr.position)
|
FunctionCallExpression(IdentifierReference(listOf("boolean"), expr.position), mutableListOf(expr), expr.position)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ For next release
|
|||||||
- petaxian roller.p8 line 49 (also see test.p8) generates large code compared to 8.2
|
- petaxian roller.p8 line 49 (also see test.p8) generates large code compared to 8.2
|
||||||
|
|
||||||
- code gen for if statements has become inefficient? vm/6502?
|
- code gen for if statements has become inefficient? vm/6502?
|
||||||
if not diskio.iteration_in_progress or not num_bytes
|
if not a or not b
|
||||||
return 0
|
return 0
|
||||||
- code gen for while loops has become inefficient: (until loops probably as well)
|
- code gen for while loops has become inefficient: (until loops probably as well)
|
||||||
(maybe solved when if statements code has been fixed)
|
(maybe solved when if statements code has been fixed)
|
||||||
@ -22,8 +22,8 @@ For next release
|
|||||||
can do this for instance by replacing and/or/xor with their bitwise versions &, |, ^
|
can do this for instance by replacing and/or/xor with their bitwise versions &, |, ^
|
||||||
- ...or: 6502: fix logical and/or/xor routines to just be bitwise routines.
|
- ...or: 6502: fix logical and/or/xor routines to just be bitwise routines.
|
||||||
|
|
||||||
- not-problem: assembler generates faulty code when in wrapWithBooleanConversion() the "not" exception is removed
|
- not-problem: assembler generates faulty code when in wrapWithBooleanConversion() the "not" rule is enabled
|
||||||
so that these are not wrapped - apparently 'not' codegen doesn't directly generate correct code?
|
so that these are not wrapped (even without optimizations)
|
||||||
- re-enable unittest "various 'not' operator rewrites even without optimizations on" when not-problem is fixed
|
- re-enable unittest "various 'not' operator rewrites even without optimizations on" when not-problem is fixed
|
||||||
|
|
||||||
- compiling logical.p8 to virtual with optimization generates a lot larger code as without optimizations.
|
- compiling logical.p8 to virtual with optimization generates a lot larger code as without optimizations.
|
||||||
|
@ -21,6 +21,10 @@ main {
|
|||||||
a1++
|
a1++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not a1 or not a2 {
|
||||||
|
a1++
|
||||||
|
}
|
||||||
|
|
||||||
if a1!=99 and not a2 {
|
if a1!=99 and not a2 {
|
||||||
a1++
|
a1++
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user