This is an archive of the discontinued LLVM Phabricator instance.

[llvm-c] Expose getFunctionAddress, as a modern alternative
ClosedPublic

Authored by artagnon on Dec 22 2014, 10:17 AM.

Details

Reviewers
whitequark
Summary

The OCaml bindings use getPointerToGlobal as the primary way to get a
handle on functions to run. This function is broken and deprecated, and
we want to transition to the modern getFunctionAddress alternative. This
is a two step process: first, there needs to be a C wrapper that OCaml
can leverage. So, build LLVMGetFunctionAddress with a test.

Second, there needs to be an OCaml interface to the new
LLVMGetFunctionAddress C function. This will be done in another patch.

Diff Detail

Event Timeline

artagnon updated this revision to Diff 17564.Dec 22 2014, 10:17 AM
artagnon retitled this revision from to [llvm-c] Expose getFunctionAddress, as a modern alternative.
artagnon updated this object.
artagnon edited the test plan for this revision. (Show Details)
artagnon added a reviewer: whitequark.
artagnon added a subscriber: Unknown Object (MLST).
whitequark edited edge metadata.Dec 22 2014, 10:23 AM

Since getPointerToGlobal was equivalent to getGlobalValueAddress, you should at least expose both getGlobalValueAddress and getFunctionAddress.

lib/ExecutionEngine/ExecutionEngineBindings.cpp
332

Is this really necessary?

"Clients that intend to execute code locally can use the getFunctionAddress call, which will generate code and apply final preparations all in one step."

artagnon updated this revision to Diff 17566.Dec 22 2014, 10:49 AM
artagnon edited edge metadata.

Respond to whitequark's review:

  1. Remove the unnecessary finalizeObject() call.
  2. Wrap getGlobalValueAddress() as well.
whitequark accepted this revision.Dec 22 2014, 10:55 AM
whitequark edited edge metadata.
This revision is now accepted and ready to land.Dec 22 2014, 10:55 AM