[LLVMdev] Implementing platform specific library call simplification

Chris Lattner clattner at apple.com
Thu Feb 24 10:32:18 PST 2011


On Feb 24, 2011, at 12:41 AM, John Criswell wrote:

>>>> At the moment I've got this working locally by adding code to the
>>>> simplify-libcalls pass. However this will break on targets where
>>>> iprintf() isn't available. Is there a sensible place to add information
>>>> about which library functions are available for a particular target?
>>> I'd suggest adding a bool argument (HasIPrintf) to the createSimplifyLibCallsPass function and the pass constructor.  Then clang (or whatever is setting up the pass manager) can query the appropriate target info to pass down this flag.
> 
> Sorry to jump into something midstream, but I just happened to read the 
> above paragraph and thought I should comment.  Adding a boolean argument 
> to a pass's constructor method is one of the things I have learned not 
> to do.  If I ever give a "How Not to Write an LLVM Pass" talk, this will 
> be one of the things in the list.

FWIW, the patch didn't do that.  SimplifyLibcalls depends on TargetLibraryInfo, which is an analysis pass.

-Chris



More information about the llvm-dev mailing list