diff options
author | Suleyman Farajli <suleyman@farajli.net> | 2025-01-01 23:47:37 +0400 |
---|---|---|
committer | Suleyman Farajli <suleyman@farajli.net> | 2025-01-01 23:47:37 +0400 |
commit | 6d51febae2ae35ebd3960a4ae087e89bd2988c5d (patch) | |
tree | cf958ef86da5902d408fd5f233b73d1e01ca7c1b /src | |
parent | b25dee3a5a1893775f187734280f8a99a02df02b (diff) |
`2swap` added
Diffstat (limited to 'src')
-rw-r--r-- | src/main.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.go b/src/main.go index c636516..68db099 100644 --- a/src/main.go +++ b/src/main.go @@ -110,6 +110,8 @@ func parse(tokens[]Token) []Operation { op.name = "drop" case "swap": op.name = "swap" + case "2swap": + op.name = "2swap" case "if": op.name = "if" op.crosslabel = fmt.Sprintf(".if%d", iflabel) @@ -225,6 +227,8 @@ func X86_64map(op Operation) string{ return "\tpop r10\n" case "swap": return "\tpop r11\n\tpop r10\n\tpush r11\n\tpush r10\n" + case "2swap": + return "\tpop rax\n\tpop rsi\n\tpop r11\n\tpop r10\n\tpush rsi\n\tpush rax\n\tpush r10\n\tpush r11\n" case "if": return fmt.Sprintf("\tpop r10\n\tcmp r10, 0\n\tje %s\n", op.crosslabel) case "else": |