diff --git a/stepper.py b/stepper.py index 1592f05..980845f 100644 --- a/stepper.py +++ b/stepper.py @@ -64,7 +64,18 @@ def step(insns, terminator, blocks, stack_frames, ssa_env, global_env, heap, elif isinstance(next_insn, ll.Load): TODO('Load') elif isinstance(next_insn, ll.Store): - TODO('Store') + ty = next_insn.ty + value = next_insn.value + location = next_insn.location + + value_v = eval_oper(value, ssa_env, global_env) + location_v = eval_oper(location, ssa_env, global_env) + + # TODO + print('heap[{}] <- {}' + .format(location_v, value_v)) + + heap[location_v] = value_v elif isinstance(next_insn, ll.Icmp): cnd = next_insn.cnd left = next_insn.left @@ -333,7 +344,7 @@ def gogo(): data = r''' define i64 @tigermain (i64 %U_mainSL_8, i64 %U_mainDummy_9) { %a = alloca i64 - %b = alloca i64 + store i64 9, i64* %a ret i64 77 } '''