data exchange between loadable pass and backend

Hello,

I have an analysis pass and a target machine class, both in different dynamically loadable libraries (plugins). There is no problem to use the analysis pass (opt -load=libanalysis.dylib -barpass foo.bc), but is it possible to get data from the analysis pass (by getAnalysis) while using the backend?
AFAIK it is only allowed to have one plugin argument for llc (like: llc -load=libbackend.dylib -march=foo bar.bc). Did I miss something?

Is the only solution to put the analysis pass in the target machine library?

Thanks,
Nico

Nico wrote:

Hello,

I have an analysis pass and a target machine class, both in different
dynamically loadable libraries (plugins). There is no problem to use
the analysis pass (opt -load=libanalysis.dylib -barpass foo.bc), but
is it possible to get data from the analysis pass (by getAnalysis)
while using the backend?
AFAIK it is only allowed to have one plugin argument for llc (like:
llc -load=libbackend.dylib -march=foo bar.bc). Did I miss something?
  

Have you tried using the -load option twice? You can specify multiple -load options to the opt tool; I wouldn't be surprised if llc allows the same thing, and if not, you could probably change it to do so.

Another option that might work would be to create a third shared object from your two libraries. Something like:

gcc -shared -o combined.dylib libbackend.dylib libanalysis.dylib

We've done this on Linux for loading libraries into opt; maybe it will work on Mac OS X as well.

-- John T.