[LLVMdev] Requiring dynamically loaded passes
Gordon Henriksen
gordonhenriksen at mac.com
Tue Dec 4 08:58:00 PST 2007
On Dec 4, 2007, at 11:24, Vikram S. Adve wrote:
> Is it possible to AddRequired<...> a pass that is dynamically
> loaded? This would be very convenient for a course project but the
> documentation about pass interactions says nothing about dynamically
> loaded passes and vice versa.
>
> More specifically, to refer to the pass name in AddRequired, I need
> to declare it first but then I can't think of a way to load the
> module implementing the pass dynamically instead of linking it
> statically.
I think if you define the pass ID in your host and use AddRequiredID
instead of AddRequired:
char LoadablePassID = 0;
...
AU.addRequiredID(lookupPassInfo((intptr_t) &LoadablePassID));
then it should work if the loadable module references the same pass ID
as an extern:
extern char ExternalPassID;
class ThePass : public ImmutablePass {
public:
ThePass : ImmutablePass(&ExternalPassID) {}
};
An analysis group may also be a viable option.
— Gordon
More information about the llvm-dev
mailing list