O LLVM Interpreter
The goal of this lab is to implement an interpreter for the SmaLLVM language
that is a subset of LLVM]
Copyright By PowCoder代写 加微信 powcoder
A program is a tuple (IL, next) where L is a set of program labels and next C Lx
I is the control-flow relation of the program. Each program point is associated
with a command denoted by cmd(!).
The small-step operational semantics of SmaLLVM is defined as a transition
system (S,4). The set S denotes a set of state that is a pair of a program point
and a memory. The transition relation (4) C S x S is defined as follows:
Notice that Input and Print have side-effect (read from stdin and write to
stdout) as well as state transitions.
For brevity, we omit the formal semantics of phi nodes but informally de-
scribe the semantics. The semantics of a phi node is determined by the output
memory of the previously executed block. Thus, the updated memory by one phi
node does not affect the semantics of the next phi node in the same block. For
more details, see the LLVM reference page-
The semantic function of expression [El : M › V is defined as follows:
The semantic function of expression El: M› V is defined as follows:
[false] (m)
[E; © E. (m)
[E 0 El(m)
[E](m) © (El(m)
[EN(m) © [E](m)
The semantics of @ and @ follows the standard definition of arithmetic and
comparison operators of LLVM. However, the interpreter will not take into
account the sign of operators. That is, all the operators and integer values are
assumed to be signed.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com