Improve presentation.

This commit is contained in:
cfreksen 2017-10-30 00:00:35 +01:00
parent 14d9215ac4
commit 5fc3e23ae5
No known key found for this signature in database
GPG Key ID: EAC13EE101008978

View File

@ -22,6 +22,9 @@ def warn(msg):
class Garbage(Enum): class Garbage(Enum):
GARBAGE = '<<Unitialized memory>>' GARBAGE = '<<Unitialized memory>>'
def __repr__(self):
return '<<Garbage>>'
def step(insns, terminator, blocks, stack_frames, ssa_env, global_env, heap, def step(insns, terminator, blocks, stack_frames, ssa_env, global_env, heap,
tdecs, fdecs, call_res): tdecs, fdecs, call_res):
@ -347,6 +350,8 @@ def ty2base_ty(ty, tdecs, seen=[]):
if isinstance(ty, ll.SimpleType): if isinstance(ty, ll.SimpleType):
return ty return ty
elif isinstance(ty, ll.PointerType): elif isinstance(ty, ll.PointerType):
# TODO: Consider if types behind pointers should not be
# expanded. They might be allowed for cyclic types
return ll.PointerType(ty2base_ty(ty.inner_ty, tdecs, seen)) return ll.PointerType(ty2base_ty(ty.inner_ty, tdecs, seen))
if isinstance(ty, ll.StructType): if isinstance(ty, ll.StructType):
return ll.StructType([ty2base_ty(t, tdecs, seen) return ll.StructType([ty2base_ty(t, tdecs, seen)
@ -424,8 +429,10 @@ define i64 @tigermain (i64 %U_mainSL_8, i64 %U_mainDummy_9) {
fdecs, call_res) fdecs, call_res)
step_cnt += 1 step_cnt += 1
if terminator is None: if terminator is None:
print('Stepping done! Final ssa_env:\n{}' print('Stepping done!\nFinal ssa_env: {}'
.format(ssa_env)) .format(ssa_env))
print('Final heap: {}'
.format(heap))
print('Program resulted in {}'. print('Program resulted in {}'.
format(insns[0][1].val)) format(insns[0][1].val))
break break