mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
[Tolk] Refactor: get rid of split_vars, construct valid LET ops
In FunC (and in Tolk before), tensor vars (actually occupying several stack slots) were represented as a single var in terms or IR vars (Ops): > var a = (1, 2); > LET (_i) = (_1, _2) Now, every tensor of N stack slots is represented as N IR vars. > LET (_i, _j) = (_1, _2) This will give an ability to control access to parts of a tensor when implementing `tensorVar.0` syntax.
This commit is contained in:
parent
989629a832
commit
565bc59735
17 changed files with 100 additions and 217 deletions
|
@ -104,9 +104,9 @@ fun testStartBalanceCodegen2() {
|
|||
testDumpDontPolluteStack PROC:<{
|
||||
...
|
||||
DUMPSTK
|
||||
x{6d79} PUSHSLICE // f s _9
|
||||
x{6d79} PUSHSLICE // f s _5
|
||||
STRDUMP DROP
|
||||
SBITS // f _11
|
||||
SBITS // f _6
|
||||
}>
|
||||
"""
|
||||
|
||||
|
|
|
@ -220,11 +220,11 @@ Note, that since 'compute-asm-ltr' became on be default, chaining methods codege
|
|||
1 PUSHINT // _0 _1=1
|
||||
SWAP // _1=1 _0
|
||||
32 STU // _0
|
||||
2 PUSHINT // _0 _5=2
|
||||
SWAP // _5=2 _0
|
||||
2 PUSHINT // _0 _4=2
|
||||
SWAP // _4=2 _0
|
||||
32 STU // _0
|
||||
3 PUSHINT // _0 _9=3
|
||||
SWAP // _9=3 _0
|
||||
3 PUSHINT // _0 _7=3
|
||||
SWAP // _7=3 _0
|
||||
32 STU // _0
|
||||
}>
|
||||
"""
|
||||
|
|
|
@ -332,15 +332,15 @@ These are moments of future optimizations. For now, it's more than enough.
|
|||
DUP // x x
|
||||
IFNOTJMP:<{ // x
|
||||
DROP //
|
||||
1 PUSHINT // _7=1
|
||||
1 PUSHINT // _5=1
|
||||
}> // x
|
||||
DUP // x x
|
||||
IFNOTJMP:<{ // x
|
||||
DROP //
|
||||
1 PUSHINT // _8=1
|
||||
1 PUSHINT // _6=1
|
||||
}> // x
|
||||
100 THROWIFNOT
|
||||
-4 PUSHINT // _12=-4
|
||||
-4 PUSHINT // _9=-4
|
||||
}>
|
||||
"""
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ fun main(){}
|
|||
...
|
||||
incrementTwoInPlace CALLDICT // x y sum1
|
||||
-ROT
|
||||
10 PUSHINT // sum1 x y _8=10
|
||||
10 PUSHINT // sum1 x y _10=10
|
||||
incrementTwoInPlace CALLDICT // sum1 x y sum2
|
||||
s1 s3 s0 XCHG3 // x y sum1 sum2
|
||||
}>
|
||||
|
@ -317,8 +317,8 @@ fun main(){}
|
|||
"""
|
||||
load_next PROC:<{
|
||||
// cs
|
||||
32 LDI // _3 cs
|
||||
SWAP // cs _3
|
||||
32 LDI // _4 cs
|
||||
SWAP // cs _4
|
||||
}>
|
||||
"""
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ fun main() {
|
|||
CONS // numbers
|
||||
UNCONS // h numbers
|
||||
DUP // h numbers numbers
|
||||
CAR // h numbers _12
|
||||
CAR // h numbers _13
|
||||
"""
|
||||
|
||||
@fif_codegen
|
||||
|
@ -133,7 +133,7 @@ fun main() {
|
|||
"""
|
||||
test7 PROC:<{
|
||||
...
|
||||
LDOPTREF // b _18 _17
|
||||
LDOPTREF // b _8 _7
|
||||
DROP // b c
|
||||
ISNULL // b _11
|
||||
10 MULCONST // b _13
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue