support older python versions a bit more
This commit is contained in:
@@ -25,7 +25,7 @@ class X86_64Generator(Generator):
|
|||||||
|
|
||||||
def get_variable(self, var_name: str, reg: str):
|
def get_variable(self, var_name: str, reg: str):
|
||||||
self.push(
|
self.push(
|
||||||
f"QWORD [rsp + {(self.stack_size - self.variables.get(var_name)["stack_loc"] - 1) * 8}]"
|
f"QWORD [rsp + {(self.stack_size - self.variables.get(var_name)['stack_loc'] - 1) * 8}]"
|
||||||
)
|
)
|
||||||
self.pop(reg)
|
self.pop(reg)
|
||||||
|
|
||||||
|
14
out.asm
14
out.asm
@@ -1,15 +1,17 @@
|
|||||||
global _start
|
global _start
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
; InstructionNode(instruction='set', parent=RootNode(statements=[..., InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
; InstructionNode(instruction='set', parent=RootNode(statements=[..., InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='add', parent=..., arguments=[VariableReference, Number, VariablePointer]), InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
||||||
mov rax, 6
|
mov rax, 66
|
||||||
push rax
|
push rax
|
||||||
; InstructionNode(instruction='set', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ..., InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
; InstructionNode(instruction='set', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ..., InstructionNode(instruction='add', parent=..., arguments=[VariableReference, Number, VariablePointer]), InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariablePointer, Number])
|
||||||
mov rax, 7
|
mov rax, 69
|
||||||
push rax
|
push rax
|
||||||
; InstructionNode(instruction='end', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ...]), arguments=[VariableReference])
|
; InstructionNode(instruction='add', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), ..., InstructionNode(instruction='end', parent=..., arguments=[VariableReference])]), arguments=[VariableReference, Number, VariablePointer])
|
||||||
|
; FUCK
|
||||||
|
; InstructionNode(instruction='end', parent=RootNode(statements=[InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='set', parent=..., arguments=[VariablePointer, Number]), InstructionNode(instruction='add', parent=..., arguments=[VariableReference, Number, VariablePointer]), ...]), arguments=[VariableReference])
|
||||||
mov rax, 60
|
mov rax, 60
|
||||||
push QWORD [rsp + 0]
|
push QWORD [rsp + 8]
|
||||||
pop rdi
|
pop rdi
|
||||||
syscall
|
syscall
|
||||||
|
|
@@ -1,3 +1,4 @@
|
|||||||
set &x 6
|
set &x 66
|
||||||
set &y 7
|
set &y 69
|
||||||
end $y
|
add $x 1 &x
|
||||||
|
end $x
|
Reference in New Issue
Block a user