mirror of
https://github.com/irmen/prog8.git
synced 2025-02-20 03:29:01 +00:00
fix
This commit is contained in:
parent
c8531cbeb1
commit
5196443b26
@ -1014,9 +1014,6 @@ class IRCodeGen(
|
|||||||
else
|
else
|
||||||
addInstr(result, IRInstruction(Opcode.BNE, irDtLeft, reg1 = tr.resultReg, immediate = 0, labelSymbol = goto.identifier!!.name), null)
|
addInstr(result, IRInstruction(Opcode.BNE, irDtLeft, reg1 = tr.resultReg, immediate = 0, labelSymbol = goto.identifier!!.name), null)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// TODO use immediate branch instructions if the value is constant
|
|
||||||
|
|
||||||
val leftTr = expressionEval.translateExpression(condition.left)
|
val leftTr = expressionEval.translateExpression(condition.left)
|
||||||
addToResult(result, leftTr, leftTr.resultReg, -1)
|
addToResult(result, leftTr, leftTr.resultReg, -1)
|
||||||
val opcode: Opcode
|
val opcode: Opcode
|
||||||
|
@ -46,7 +46,7 @@ internal class IRPeepholeOptimizer(private val irprog: IRProgram) {
|
|||||||
/*
|
/*
|
||||||
Empty Code chunk with label ->
|
Empty Code chunk with label ->
|
||||||
If next chunk has no label -> move label to next chunk, remove original
|
If next chunk has no label -> move label to next chunk, remove original
|
||||||
If next chunk has label -> label name should be the same, remove original. Otherwise FOR NOW leave it in place. (TODO: consolidate labels into 1)
|
If next chunk has label -> label name should be the same, remove original. Otherwise FOR NOW leave it in place. (TODO: merge both labels into 1)
|
||||||
If is last chunk -> keep chunk in place because of the label.
|
If is last chunk -> keep chunk in place because of the label.
|
||||||
Empty Code chunk without label ->
|
Empty Code chunk without label ->
|
||||||
should not have been generated! ERROR.
|
should not have been generated! ERROR.
|
||||||
@ -71,7 +71,7 @@ internal class IRPeepholeOptimizer(private val irprog: IRProgram) {
|
|||||||
if (chunk.label == nextchunk.label)
|
if (chunk.label == nextchunk.label)
|
||||||
removeChunks += index
|
removeChunks += index
|
||||||
else {
|
else {
|
||||||
// TODO: consolidate labels on same chunk
|
// TODO: merge labels on same chunk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,6 @@ data class InstructionFormat(val datatype: IRDataType?,
|
|||||||
fr0... = fp register
|
fr0... = fp register
|
||||||
a = memory address
|
a = memory address
|
||||||
i = immediate value
|
i = immediate value
|
||||||
TODO: also encode if *memory* is read/written/modified?
|
|
||||||
*/
|
*/
|
||||||
val instructionFormats = mutableMapOf(
|
val instructionFormats = mutableMapOf(
|
||||||
Opcode.NOP to InstructionFormat.from("N"),
|
Opcode.NOP to InstructionFormat.from("N"),
|
||||||
@ -516,10 +515,10 @@ val instructionFormats = mutableMapOf(
|
|||||||
Opcode.JUMP to InstructionFormat.from("N,<a"),
|
Opcode.JUMP to InstructionFormat.from("N,<a"),
|
||||||
Opcode.JUMPA to InstructionFormat.from("N,<a"),
|
Opcode.JUMPA to InstructionFormat.from("N,<a"),
|
||||||
Opcode.CALL to InstructionFormat.from("N,<a"),
|
Opcode.CALL to InstructionFormat.from("N,<a"),
|
||||||
Opcode.CALLRVAL to InstructionFormat.from("BW,<r1,<a | F,<fr1,<a"),
|
Opcode.CALLRVAL to InstructionFormat.from("BW,>r1,<a | F,>fr1,<a"),
|
||||||
Opcode.SYSCALL to InstructionFormat.from("N,<i"),
|
Opcode.SYSCALL to InstructionFormat.from("N,<i"),
|
||||||
Opcode.RETURN to InstructionFormat.from("N"),
|
Opcode.RETURN to InstructionFormat.from("N"),
|
||||||
Opcode.RETURNREG to InstructionFormat.from("BW,<r1 | F,<fr1"),
|
Opcode.RETURNREG to InstructionFormat.from("BW,>r1 | F,>fr1"),
|
||||||
Opcode.BSTCC to InstructionFormat.from("N,<a"),
|
Opcode.BSTCC to InstructionFormat.from("N,<a"),
|
||||||
Opcode.BSTCS to InstructionFormat.from("N,<a"),
|
Opcode.BSTCS to InstructionFormat.from("N,<a"),
|
||||||
Opcode.BSTEQ to InstructionFormat.from("N,<a"),
|
Opcode.BSTEQ to InstructionFormat.from("N,<a"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user