<div dir="ltr"><br clear="all"><div>I am writing an analysis pass on LLVM which requires to:</div><div><br></div><div>   [1] generate unique, positive ID corresponding to each instruction</div><div>   [2] the ID must survive across runs</div><div>   [3] given the ID, corresponding instruction has to be mapped back</div><div><br></div><div>For [1], the general suggestion is to use the Value* instr_ptr associated to each instruction. The instr_ptr points to specific instruction in memory, hence unique. However, it does change at every run, thus violating [2]. I have a hacking workaround of getting the first instruction of 'main' method and computing the offset. The problem is, this gives me negative offset for instructions lying in lower memory region than 'main'. Even if I circumvent the problem by adding a positive bias high enough, I have no clue how can I map the instr_ptr back to corresponding IR instruction. Can anyone suggest any elegant workaround?</div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</div>