Commit 08d525ab authored by Kunshan Wang's avatar Kunshan Wang

Added COMMINST for ID-to-toplevel lookup

Without those COMMINSTs, the top-level definitions of dynamically loaded
bundles cannot be used at all unless the C-based client interface is
used.
parent ecef49cd
......@@ -520,6 +520,39 @@ form of Mu IR programs) which is updated with each bundle loading. In other
words, if the client does not maintain such a map, Mu will have to maintain it
for the client.
Dynamic Top-level Definition Lookup
-----------------------------------
::
[0x268]@uvm.meta.constant_by_id <T> (%id: int<32>) -> T
[0x269]@uvm.meta.global_by_id <T> (%id: int<32>) -> T
[0x26a]@uvm.meta.func_by_id <T> (%id: int<32>) -> T
[0x26b]@uvm.meta.expfunc_by_id <T> (%id: int<32>) -> T
These common instructions get the value of top-level definitions (i.e. global
SSA variables) by their IDs. These functions are useful after a Mu IR bundle is
built at run time, and the IDs of the new top-level definitions are generated by
the IR builder.
``%id`` is the ID of the top-level definition. ``T`` is the type of the
top-level definition. Particularly, the type of a constant is the type
parameter of the constant definition; the type of a global cell is always
``iref<U>`` for some ``U``; the type of a function is always ``funcref<sig>``
for some ``sig``; the type of an exposed function is implementation-defined,
most likely ``ufuncptr<sig>`` for some ``sig``. The return value is the same as
`the SSA variable of the top-level definition
<instruction-set#global-variable>`__.
- ``constant_by_id`` gets the value of a constant.
- ``global_by_id`` gets the internal reference of the global cell.
- ``func_by_id`` gets the function reference of the function.
- ``expfunc_by_id`` gets the implementation-dependent value of the exposed
function.
IR Building Interface
---------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment