[Trouble understanding semantics.ml][Hw2] #422
-
|
I am working on the Homework 2 assignment but I am having some trouble understanding what to do in the semantics.ml implementation. I am mainly confused about how to use the modules in domain.ml and how to use the LLVM data structure and APIs. (I've also read the documentation but am still confused...https://github.com/prosyslab-classroom/llvm-primer/blob/master/data-structure.md https://llvm.moe/ocaml/Llvm.html). Based on this issue from last year #21, the types of each function have been provided: eval : Llvm.llvalue -> Memory.t -> Value.t But I can't find any API functions that I can use such that my implementation matches the provided function type. For example, for the eval function, there doesn't seem to be any way to output a Value given an Llvm.llvalue. I am also not sure how to proceed with the implementation for the transfer function.
But even after reading the documentation I am not sure how to implement these steps. I am also wondering if you could clarify the wording for the PHI implementation Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Let me try to organize your question into 3 parts and answer them respectively.
Good luck. |
Beta Was this translation helpful? Give feedback.
Let me try to organize your question into 3 parts and answer them respectively.
Can't find any API functions
Let me answer this with the example you gave us. In short, there is no API function that directly outputs a
Valuetype given anLlvm.llvalue. This is the very part that you need to implement by yourself. To give a hint, try to decompose the givenLlvm.llvalueto compose a new Value type with it. Try using the API functions in https://llvm.moe/ocaml/Llvm.html.How to implement the transfer function.
First of all, your reasoning for the implementation is correct. And yes, you would need to use
Memory.addto update the memory. Finally,instrinexecute_instrandtransferfunction …