-
Notifications
You must be signed in to change notification settings - Fork 19
Description
I have several questions to clarify my understanding on semantics.ml codes.
- Types of functions
Because there were no type annotations on the skeleton code, I want to check types of functions in the code.
eval: llvalue -> Memory -> Value
execute_block: (llbasicblock * llvalue) option -> llbasicblock -> Memory -> Memory
execute_instr: (llbasicblock * llvalue) option -> (llbasicblock * llvalue) llpos -> Memory -> Memory
transfer: (llbasicblock * llvalue) option -> llvalue -> Memory -> Memory
Although it is not explicitly shown in the code or document, I think execute_block, execute_instr, transfer functions should have Memory return types, because it is implementing transitional semantics.
Are these correct types?
- Iterating through instructions in block
In execute_block function, execute_instr function is only once on the first instructions. This means that in order to compute total result of a block, there should be some kind of iteration through instructions in the block in execute_instr or transfer function. However we only have rooms to implement in transfer function, at each pattern cases. Does this mean that we need some recursion to iterate through the block? In addition, can we change the parts of codes other than failwith "Not implemented" so that this iteration can be efficiently implemented?
- Distinguishing Int (Int32) and Bool (Int 1) in
evalfunction
Readme mentions that Int32 should be interpreted as Integer constant and Int1 should be interpreted as Bool. This should happen when matching ValueKind of expression in eval function. Given only e: llvalue which is matched to ValueKind.ConstantInt, how can we known that it's Int32 or Int1?