Compare commits
1 Commits
f561a849c2
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0e37cccd7a |
@@ -189,7 +189,7 @@ class X86_64Generator(Generator):
|
||||
elif type(new_value) == str: # we're changing a variable to the value of a register
|
||||
#lines.append(f"mov QWORD [rsp + {var_pos}], {new_value}\n\t")
|
||||
lines.append(f"mov {var_pos}, {new_value}\n\t")
|
||||
scope.table[var_name]["type"] = IntNode
|
||||
#scope.table[var_name]["type"] = IntNode
|
||||
|
||||
|
||||
else:
|
||||
@@ -227,7 +227,8 @@ class X86_64Generator(Generator):
|
||||
|
||||
elif type(new_value) == str: # we're changing a variable to the value of a register
|
||||
lines.append(f"mov QWORD [rsp + {var_pos}], {new_value}\n\t")
|
||||
scope.table[var_name]["type"] = IntNode
|
||||
#scope.table[var_name]["type"] = IntNode
|
||||
|
||||
if scope.table[var_name]["type"] != old_var_type:
|
||||
warning(self.code, f"Changing the type of \"{var_name}\" at runtime is considered bad practice.")
|
||||
|
||||
@@ -697,6 +698,7 @@ class X86_64Generator(Generator):
|
||||
with open(self.output_path + ".asm", "w") as f:
|
||||
f.write("; ~~~ Auto generated by the GroundPY compiler for Linux x86_64 targets. ~~~\n\n")
|
||||
|
||||
if len(self.constants) > 0:
|
||||
f.write("section .data\n")
|
||||
for name, const in self.constants.items():
|
||||
value = const["value"]
|
||||
@@ -718,6 +720,7 @@ class X86_64Generator(Generator):
|
||||
f.write(f"dq {float(value)}")
|
||||
f.write("\n")
|
||||
|
||||
if len(self.buffers) > 0:
|
||||
f.write("section .bss\n")
|
||||
for buf, size in self.buffers.items():
|
||||
f.write(f"{buf} resb {size}\n")
|
||||
|
5
out.asm
Normal file
5
out.asm
Normal file
@@ -0,0 +1,5 @@
|
||||
; ~~~ Auto generated by the GroundPY compiler for Linux x86_64 targets. ~~~
|
||||
|
||||
section .text
|
||||
global _start
|
||||
_start:
|
Reference in New Issue
Block a user