From d48042b01eae60de77e200183ac15c315e262377 Mon Sep 17 00:00:00 2001 From: cfreksen Date: Sun, 29 Oct 2017 19:41:40 +0100 Subject: [PATCH] Add bitcast. --- ll.py | 4 ++++ stepper.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/ll.py b/ll.py index 87430a3..ffe3077 100644 --- a/ll.py +++ b/ll.py @@ -102,6 +102,10 @@ def insn2s(insn): return ('icmp {} {} {}, {}' .format(insn.cnd, ty2s(insn.ty), oper2s(insn.left), oper2s(insn.right))) + elif isinstance(insn, Bitcast): + return ('bitcast {} {} to {}' + .format(ty2s(insn.from_ty), oper2s(insn.oper), + ty2s(insn.to_ty))) elif isinstance(insn, Zext): return ('zext {} {} to {}' .format(ty2s(insn.from_ty), oper2s(insn.oper), diff --git a/stepper.py b/stepper.py index d8fb2eb..0dc4519 100644 --- a/stepper.py +++ b/stepper.py @@ -51,6 +51,16 @@ def step(insns, terminator, blocks, stack_frames, ssa_env, global_env, memory, # TODO print('icmp {} {}, {}' .format(cnd, left_v, right_v)) + elif isinstance(next_insn, ll.Bitcast): + oper = next_insn.oper + from_ty = next_insn.from_ty + to_ty = next_insn.to_ty + oper_v = eval_oper(oper, ssa_env, global_env) + res = oper_v + + # TODO + print('bitcast {} {} to {}' + .format(ll.ty2s(from_ty), oper_v, ll.ty2s(to_ty))) elif isinstance(next_insn, ll.Zext): oper = next_insn.oper from_ty = next_insn.from_ty