<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hello LLVM list,<br><br></div>I am writing a JIT compiler for a SQL in-memory database and I have an issue:<br></div>I want to compile specialized functions per-object which replace a virtual function call.<br>
</div><br></div>What I want to achieve is to feed memory from runtime into the code. I know the runtime value behind some values (especially the 'this' pointer) and want llvm to profit from that additional knowledge for instance by replacing loads of memory where I know it's constant (i.e. the virtual function table; some fields that are only changed in the constructor, etc.)<br>
<br></div>In the moment I see 3 ways to achieve this<br></div>1. find all loads, check the range and replace them by their loaded value<br></div>2. add store instructions in the beginning of the code that override the "unknown" values with their known parts (ugly - consumes memory bandwith and requires an additional GVN pass)<br>
</div>3. a weak store instruction which is ignored by the code generator but gives hints to the load-store-optimization<br></div>4. do have an other idea?<br><br></div>Greetings<br></div>