[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-dev
Subject:    Re: [LLVMdev] RegisterPass isAnalysis parameter
From:       Tom Prince <tom.prince () ualberta ! net>
Date:       2010-02-27 3:42:17
Message-ID: 20100227034216.GB13390 () hermes ! hocat ! ca
[Download RAW message or body]

On Fri, Feb 26, 2010 at 05:22:49PM -0800, Trevor Harmon wrote:
> On Feb 25, 2010, at 5:45 PM, David A. Greene wrote:
> 
> > The RegisterPass template takes care of notifying the PassManager
> > that the pass exists.  One of the advantages of PassManager is
> > that it decouples pass execution from the rest of the infrastructure
> > so the class need not be visible to anything outside the  
> > implementation
> > of the pass itself.
> 
> Even though the PassManager implements the Hollywood Principle,  
> something outside of the pass implementation still has to invoke one  
> of the runOn* functions. And I'm not understanding how this invocation  
> can occur if the implementation is invisible. Maybe I should just  
> chalk this up to template magic...

I'm not familiar with this particular code, and haven't looked at the
implementation. However, the rule about anonymous namespaces is slightly
subtler. You cannot refer to anything in anonymous namespace by name from
another file, however, if you have a pointer, say, then you can still use the
pointer. I suspect that the template in question registers the pass with the
PassManager or something (through a static initialization?). Thus, even though
the implementation is invisible (unnameable?) other code still know where it
is.

  Tom
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic