[LLVMdev] Target data question

Kenneth Uildriks kennethuil at gmail.com
Wed Oct 21 09:31:27 PDT 2009


On Wed, Oct 21, 2009 at 10:59 AM, Kenneth Uildriks <kennethuil at gmail.com> wrote:
> If the TargetData pass isn't registered in the global registry,
> getPassInfo() returns null.
>
> Now when you add a TargetData pass, it winds up in ImmutablePasses.
> Any search through ImmutablePasses assumes that getPassInfo() for
> every member returns something other than null.  So findAnalysisPass
> for *any* analysis pass can crash the system if the TargetData pass is
> lurking in the list without being registered.
>
> Since we want to be able to run opt without a TargetData pass, this
> will never do.  If TargetData is registered globally, any
> findAnalysisPass call will find it if there isn't another TargetData
> pass in the PassManager.  Should TargetData now not be considered an
> ImmutablePass?  Should findAnalysisPass include a null check on the
> getPassInfo of ImmutablePasses?
>

Never mind, I got confused.  Registering a pass doesn't mean that
getAnalysisIfAvailable will return it; it still has to be in the pass
manager's collection.  It just means that PassInfo will be available
for it if it's there.

I think...

Anyway, my present plan of attack is to have a "-defaulttarget" option
with "none", "host", or a target string.  If -defaulttarget is not
specified, the behavior of "opt" will be the same as it is presently.
The defaulttarget will be overridden by the Module's target data if it
has some.  "none" means that no TargetData pass will be added unless
the Module supplies target data.  "host" uses the running host's
TargetData as the default.

What do y'all think?




More information about the llvm-dev mailing list