[LLVMdev] Changing the LLVM C API to remove a pass

Meador Inge meadori at codesourcery.com
Tue Mar 26 12:29:40 PDT 2013


On 03/21/2013 09:41 AM, Duncan Sands wrote:

> I think you should try to keep them.  I guess LLVMAddSimplifyLibCallsPass can be
> changed to do nothing (or produce a warning).  Probably
> LLVMPassManagerBuilderSetDisableSimplifyLibCalls
> should somehow prevent libcall simplification.

I don't see how we can prevent libcall simplification for all cases with the C
API.  The issue is that the only way to completely disable library call
simplifications now is by calling TargetLibraryInfo::disableAllFunctions.  The
various tools (opt, clang, etc...) do exactly this.

I don't see how the equivalent can be accomplished behind
LLVMPassManagerBuilderSetDisableSimplifyLibCalls since we don't always have
access to the TLI.  In some cases the TLI is set by assigning
PassManagerBuilder::LibraryInfo directly and by its C API
LLVMAddTargetLibraryInfo (although I don't see how this function is useful as I
don't see a way to *create* TargetLibraryInfo from the C API) and in other
cases it is added directly to the pass list after disableAllFunctions has
already been called on it, which is what I mentioned before that opt and clang
do.

I guess we could call disableAllFunctions for the first case where the TLI has
been directly set via LLVMAddTargetLibraryInfo.

Maybe I am just missing something?

-- 
Meador Inge
CodeSourcery / Mentor Embedded



More information about the llvm-dev mailing list