Jajoo, Malhar via llvm-dev
2017-May-23 15:32 UTC
[llvm-dev] Insert function definition at the top of the module
Hi, Just have a question here, Short: How would you insert a function definition at the top of the LLVM Module? Long: I'm trying to create monomorphic functions , so when I encounter a function call , I create concrete types for the template function. While I'm doing this , i need to codegen the function definition at the top of the module , in order for my function call to execute correctly. Any clue as to how this can be done ? Thanks , Malhar -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170523/23214a56/attachment.html>
Tim Northover via llvm-dev
2017-May-23 16:15 UTC
[llvm-dev] Insert function definition at the top of the module
On 23 May 2017 at 08:32, Jajoo, Malhar via llvm-dev <llvm-dev at lists.llvm.org> wrote:> While I'm doing this , i need to codegen the function definition at the top > of the module, in order for my function call to execute correctly.Why do you think your function has to be at the top? LLVM IR doesn't care about seeing declarations before uses and you shouldn't be able to write anything well-defined to even know what order the functions are in at runtime (the linker might reorder them on a whim for example). Cheers. Tim.