[LLVMdev] Module::getOrInsertFunction determinism
Philip Reames
listmail at philipreames.com
Thu May 29 11:34:02 PDT 2014
On 05/29/2014 11:06 AM, Tim Northover wrote:
> Hi Tomek,
>
>> I’ve got a question about Module::getOrInsertFunction().
>> I got an impression that it is not deterministic where exactly in the bit
>> code module the new function will be inserted.
> Looking at the code (not exhaustively), it seems a new function will
> always be added to the end of a module.
>
> Documenting that probably wouldn't be a terrible idea, but it
> shouldn't affect anything except the human-readability of LLVM IR. Are
> you trying to do something where it is actually causing problems?
>
> Cheers.
>
> Tim.
I would argue in favor of leaving this explicitly undocumented. I don't
see the use case in knowing where in a module it got added, and it
restricts future implementations in ways we can't predict. Documenting
that it must be deterministic is fine. Documenting where it decides to
place it is not.
Tomek, could you spell out why you need the position? Maybe there's
another option here.
Philip
More information about the llvm-dev
mailing list