[llvm-dev] Computing unique ID of IR instructions that can be mapped back

Dipanjan Das via llvm-dev llvm-dev at lists.llvm.org
Wed May 10 10:22:49 PDT 2017


On 10 May 2017 at 05:38, James Courtier-Dutton <james.dutton at gmail.com>
wrote:

>
> Why not have your analysis pass build its own map.
> The map would map between the Instruction and an integer index or offset.
> I.e.
> int index, Value *, Node *, Mod *
> Where "Value *" is the reference to the instruction itself, "Node *"
> is the BB that the instruction is contained in. "Mod *" is the module
> containing all the Nodes.
> The index will be the same every time you build the table if the IR
> has not changed.
> The analysis code then uses the index to refer back to the
> instruction's context.
>

Based on earlier replies on this thread, I plan to proceed in the exact
same way. However, it'd be more elegant (implementation-wise) to be able to
hook into the IR generation process and make the instructions carry the ID
as a metadata in the IR itself. If I implement the way you suggested (and I
am planning, too), I need to write the mapping on disk in a separate file
to be able to refer back to it later on.

-- 

Thanks & Regards,
Dipanjan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170510/de526fa0/attachment.html>


More information about the llvm-dev mailing list