Implement store.
This commit is contained in:
parent
dc1c38fbe2
commit
4fca74304a
15
stepper.py
15
stepper.py
|
@ -64,7 +64,18 @@ def step(insns, terminator, blocks, stack_frames, ssa_env, global_env, heap,
|
||||||
elif isinstance(next_insn, ll.Load):
|
elif isinstance(next_insn, ll.Load):
|
||||||
TODO('Load')
|
TODO('Load')
|
||||||
elif isinstance(next_insn, ll.Store):
|
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):
|
elif isinstance(next_insn, ll.Icmp):
|
||||||
cnd = next_insn.cnd
|
cnd = next_insn.cnd
|
||||||
left = next_insn.left
|
left = next_insn.left
|
||||||
|
@ -333,7 +344,7 @@ def gogo():
|
||||||
data = r'''
|
data = r'''
|
||||||
define i64 @tigermain (i64 %U_mainSL_8, i64 %U_mainDummy_9) {
|
define i64 @tigermain (i64 %U_mainSL_8, i64 %U_mainDummy_9) {
|
||||||
%a = alloca i64
|
%a = alloca i64
|
||||||
%b = alloca i64
|
store i64 9, i64* %a
|
||||||
ret i64 77
|
ret i64 77
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user