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) {
|
||||
// NOTE:
|
||||
|
||||
// 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)
|
||||
}
|
||||
is PipeExpression -> {
|
||||
// TODO NOT VIA STACK!!
|
||||
asmgen.translateExpression(value)
|
||||
if (assign.target.datatype in WordDatatypes && assign.source.datatype in ByteDatatypes)
|
||||
asmgen.signExtendStackLsb(assign.source.datatype)
|
||||
if(assign.target.kind!=TargetStorageKind.STACK || assign.target.datatype != assign.source.datatype)
|
||||
assignStackValue(assign.target)
|
||||
asmgen.translatePipeExpression(value.expressions, value, false, false)
|
||||
val resultDt = value.inferType(program)
|
||||
val register =
|
||||
if(resultDt.isBytes) RegisterOrPair.A
|
||||
else if(resultDt.isWords) RegisterOrPair.AY
|
||||
else if(resultDt istype DataType.FLOAT) RegisterOrPair.FAC1
|
||||
else throw AssemblyError("invalid dt")
|
||||
asmgen.assignRegister(register, assign.target)
|
||||
}
|
||||
else -> {
|
||||
// Everything else just evaluate via the stack.
|
||||
|
@ -5,11 +5,11 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
; float @shared f1
|
||||
;
|
||||
; f1 = 1.234 |> addfloat1 |> addfloat2 |> addfloat3 ; TODO fix that the value is actually returned
|
||||
; floats.print_f(f1)
|
||||
; txt.nl()
|
||||
float @shared f1
|
||||
|
||||
f1 = 1.234 |> addfloat1 |> addfloat2 |> addfloat3 ; TODO fix that the value is actually returned
|
||||
floats.print_f(f1)
|
||||
txt.nl()
|
||||
; 1.234 |> addfloat1
|
||||
; |> addfloat2 |> addfloat3 |> floats.print_f
|
||||
; txt.nl()
|
||||
|
Loading…
x
Reference in New Issue
Block a user