mirror of
https://github.com/irmen/prog8.git
synced 2025-02-28 09:29:26 +00:00
pipe expression not evaluated via stack
This commit is contained in:
parent
7135205299
commit
9e5e3d1559
@ -3413,7 +3413,6 @@ $label nop""")
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun translatePipeExpression(expressions: Iterable<Expression>, scope: Node, isStatement: Boolean, pushResultOnEstack: Boolean) {
|
internal fun translatePipeExpression(expressions: Iterable<Expression>, scope: Node, isStatement: Boolean, pushResultOnEstack: Boolean) {
|
||||||
// NOTE:
|
|
||||||
|
|
||||||
// TODO more efficient code generation to avoid needless assignments to the temp var
|
// TODO more efficient code generation to avoid needless assignments to the temp var
|
||||||
|
|
||||||
|
@ -276,12 +276,14 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
|
|||||||
assignRegisterByte(assign.target, CpuRegister.A)
|
assignRegisterByte(assign.target, CpuRegister.A)
|
||||||
}
|
}
|
||||||
is PipeExpression -> {
|
is PipeExpression -> {
|
||||||
// TODO NOT VIA STACK!!
|
asmgen.translatePipeExpression(value.expressions, value, false, false)
|
||||||
asmgen.translateExpression(value)
|
val resultDt = value.inferType(program)
|
||||||
if (assign.target.datatype in WordDatatypes && assign.source.datatype in ByteDatatypes)
|
val register =
|
||||||
asmgen.signExtendStackLsb(assign.source.datatype)
|
if(resultDt.isBytes) RegisterOrPair.A
|
||||||
if(assign.target.kind!=TargetStorageKind.STACK || assign.target.datatype != assign.source.datatype)
|
else if(resultDt.isWords) RegisterOrPair.AY
|
||||||
assignStackValue(assign.target)
|
else if(resultDt istype DataType.FLOAT) RegisterOrPair.FAC1
|
||||||
|
else throw AssemblyError("invalid dt")
|
||||||
|
asmgen.assignRegister(register, assign.target)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
// Everything else just evaluate via the stack.
|
// Everything else just evaluate via the stack.
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
; float @shared f1
|
float @shared f1
|
||||||
;
|
|
||||||
; f1 = 1.234 |> addfloat1 |> addfloat2 |> addfloat3 ; TODO fix that the value is actually returned
|
f1 = 1.234 |> addfloat1 |> addfloat2 |> addfloat3 ; TODO fix that the value is actually returned
|
||||||
; floats.print_f(f1)
|
floats.print_f(f1)
|
||||||
; txt.nl()
|
txt.nl()
|
||||||
; 1.234 |> addfloat1
|
; 1.234 |> addfloat1
|
||||||
; |> addfloat2 |> addfloat3 |> floats.print_f
|
; |> addfloat2 |> addfloat3 |> floats.print_f
|
||||||
; txt.nl()
|
; txt.nl()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user