mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +00:00
fix IR codegen missing a CMPI after if not condition
fix IR codegen for containmentcheck
This commit is contained in:
parent
31ad8bdd8d
commit
55dbd095ed
@ -229,8 +229,7 @@ internal class ExpressionGen(private val codeGen: IRCodeGen) {
|
||||
}
|
||||
addInstr(result, IRInstruction(Opcode.LOAD, IRDataType.BYTE, elementTr.resultReg, immediate = 1), gottemLabel)
|
||||
result += IRCodeChunk(endLabel, null)
|
||||
return ExpressionCodeResult(result, IRDataType.BYTE, -1, -1)
|
||||
|
||||
return ExpressionCodeResult(result, IRDataType.BYTE, elementTr.resultReg, -1)
|
||||
}
|
||||
DataType.FLOAT -> throw AssemblyError("containmentchecks for floats should always be done on an array variable with subroutine")
|
||||
else -> throw AssemblyError("weird dt $elementDt")
|
||||
|
@ -1556,6 +1556,7 @@ class IRCodeGen(
|
||||
}
|
||||
|
||||
when(val cond=ifElse.condition) {
|
||||
// TODO investigate; maybe do all conditions require a CMPI at the end? Some here still have false, but do they work correctly in all cases?
|
||||
is PtBool -> {
|
||||
// normally this will be optimized away, but not with -noopt
|
||||
translateSimple(cond, Opcode.BSTEQ, false)
|
||||
@ -1572,7 +1573,7 @@ class IRCodeGen(
|
||||
}
|
||||
is PtPrefix -> {
|
||||
require(cond.operator=="not")
|
||||
translateSimple(cond.value, Opcode.BSTNE, false)
|
||||
translateSimple(cond.value, Opcode.BSTNE, true)
|
||||
}
|
||||
is PtBinaryExpression -> {
|
||||
translateBinExpr(cond)
|
||||
|
@ -320,6 +320,7 @@ c128 {
|
||||
; TODO c128 a bunch of kernal routines are missing here that are specific to the c128
|
||||
|
||||
extsub $FF6E = JSRFAR()
|
||||
extsub $FF68 = SETBNK(ubyte databank @A, ubyte filenamebank @X)
|
||||
|
||||
|
||||
; ---- C128 specific system utility routines: ----
|
||||
|
@ -1,7 +1,11 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
make a compiler switch to disable footgun warnings
|
||||
Fix diskio (cx16, possibly other cbm targets too?) when opening write file , read file stops working
|
||||
|
||||
make a compiler switch to disable footgun warnings -ignorefootguns
|
||||
|
||||
update zsmkit to newest version that includes the on_deck routines
|
||||
|
||||
...
|
||||
|
||||
@ -9,6 +13,7 @@ make a compiler switch to disable footgun warnings
|
||||
Future Things and Ideas
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- a syntax to access specific bits in a variable, to avoid manually shifts&ands, something like variable[4:8] ? (or something else this may be too similar to regular array indexing)
|
||||
- something to reduce the need to use fully qualified names all the time. 'with' ? Or 'using <prefix>'?
|
||||
- on the C64: make the floating point routines @banked so that basic can be permanently banked out even if you use floats? But this will crash when the call is done from program code at $a000+
|
||||
- Libraries: improve ability to create library files in prog8; for instance there's still stuff injected into the start of the start() routine AND there is separate setup logic going on before calling it.
|
||||
@ -45,6 +50,7 @@ Future Things and Ideas
|
||||
|
||||
IR/VM
|
||||
-----
|
||||
- ExpressionCodeResult: get rid of the separation between single result register and multiple result registers?
|
||||
- constants are not retained in the IR file, they should. (need to be able to make asm labels from them eventually)
|
||||
- implement missing operators in AssignmentGen (array shifts etc)
|
||||
- support %align on code chunks
|
||||
|
@ -4,14 +4,11 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
txt.print_ubhex($123456>>16, true)
|
||||
txt.spc()
|
||||
txt.print_ubhex(msw($123456), true)
|
||||
txt.nl()
|
||||
|
||||
txt.print_uwhex($123456 & $ffff, true)
|
||||
txt.spc()
|
||||
txt.print_uwhex(lsw($123456), true)
|
||||
txt.nl()
|
||||
ubyte @shared index
|
||||
bool @shared success = index==0 or index==255
|
||||
if success
|
||||
txt.print("yo")
|
||||
if index==0 or index==255
|
||||
txt.print("yo")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user