[LLVMdev] Implementing platform specific library call simplification

Chris Lattner clattner at apple.com
Thu Feb 24 11:03:44 PST 2011


On Feb 24, 2011, at 10:57 AM, Frits van Bommel wrote:

> On Thu, Feb 24, 2011 at 7:32 PM, Chris Lattner <clattner at apple.com> wrote:
>> On Feb 24, 2011, at 12:41 AM, John Criswell wrote:
>>> 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.
> 
> However, TargetLibraryInfo does take a target triple (not a bool
> though) as constructor argument, defaulting to all-unknown.
> Maybe instead of being an ImmutablePass it should be a ModulePass so
> it can use Module::getTargetTriple() in runOnModule()?
> That should make it more compatible with opt & bugpoint.

opt already passes the triple into the pass.  bugpoint could do the same if it is interesting.  We already have similar issues with TargetData.

-Chris



More information about the llvm-dev mailing list