aboutsummaryrefslogtreecommitdiff
path: root/crowbar_reference_compiler
diff options
context:
space:
mode:
Diffstat (limited to 'crowbar_reference_compiler')
-rw-r--r--crowbar_reference_compiler/ssagen.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/crowbar_reference_compiler/ssagen.py b/crowbar_reference_compiler/ssagen.py
index abf5c56..5212440 100644
--- a/crowbar_reference_compiler/ssagen.py
+++ b/crowbar_reference_compiler/ssagen.py
@@ -89,7 +89,10 @@ def _(target: FunctionCallExpression, context: CompileContext) -> SsaResult:
result += compile_to_ssa(expr, context)
arg_dest = context.next_temp - 1
args += [f"l %t{arg_dest}"]
- result.code.append(f"call ${target.function.name}({','.join(args)}, ...)")
+ result_dest = context.next_temp
+ context.next_temp += 1
+ # TODO size
+ result.code.append(f"%t{result_dest} =l call ${target.function.name}({','.join(args)})")
return result
@@ -291,7 +294,7 @@ def _(target: ArrayIndexExpression, context: CompileContext) -> SsaResult:
# TODO types
result.code.append(f"%t{offset} =l mul %t{index}, {scale}")
result.code.append(f"%t{address} =l add %t{base}, %t{offset}")
- result.code.append(f"%t{dest} =l loadsw %t{address}")
+ result.code.append(f"%t{dest} =l loadl %t{address}")
return result
@@ -326,7 +329,7 @@ def _(target: StructPointerElementExpression, context: CompileContext) -> SsaRes
context.next_temp += 1
# TODO types
result.code.append(f"%t{temp} =l add %t{base_dest}, {offset}")
- result.code.append(f"%t{result_dest} =l loadsw %t{temp}")
+ result.code.append(f"%t{result_dest} =l loadl %t{temp}")
return result
@@ -352,7 +355,7 @@ def _(target: DirectAssignment, context: CompileContext) -> SsaResult:
last_instr = sub_result.code.pop()
_, _, _, location = last_instr.split(' ')
# TODO type
- sub_result.code.append(f"storew %t{result_dest}, {location}")
+ sub_result.code.append(f"storel %t{result_dest}, {location}")
result += sub_result
else:
raise NotImplementedError('assign to ' + str(type(target.destination)))