All, I have a ModulePass (A) calling a FunctionPass that inturn calls TargetData (a ModulePass). For reasons of code correctness and modularity I cannot reorganize my passes in any other way . When I use opt to load and run A , it gives the following error. LLVM ERROR: Bad TargetData ctor used. Tool did not specify a TargetData to use? I gather from some previous emails that this was not supported. Is it still not supported? and is there any way I can avoid this. Thanks and Regards Aparna Kotha Graduate Student University of Maryland, College Park -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100813/e8d88b89/attachment.html>
aparna kotha wrote:> All, > > I have a ModulePass (A) calling a FunctionPass that inturn calls > TargetData (a ModulePass). For reasons of code correctness and > modularity I cannot reorganize my passes in any other way . > > When I use opt to load and run A , it gives the following error. > > LLVM ERROR: Bad TargetData ctor used. Tool did not specify a > TargetData to use? > > > I gather from some previous emails that this was not supported. Is it > still not supported? and is there any way I can avoid this.For some reason, the TargetData pass must use a special constructor method that gives it a reference to the module to be analyzed. This means that declaring it as a dependency in your getAnalysisUsage() methods isn't enough; whatever program is adding your passes to the PassManager must add TargetData explicitly as one of the passes to run. The opt program does this automatically, so I'm assuming you're writing your own tool that creates a PassManager and tells it to run some passes. You want to add code like the following to your tool: PassManager Passes; // This line probably exists in your code already // Explicitly schedule the TargetData pass as the first pass to run; note that M.get() gets a pointer or reference // to the module to analyze Passes.add(new TargetData(M.get())); -- John T.> > > > > Thanks and Regards > > > Aparna Kotha > > Graduate Student > University of Maryland, College Park >
I am using opt , so i cm confused if i need to do this. On the other hand I modified my functionPass not to call TargetData , and I still get this error. My functionPass still calls Alias Analysis though. Aparna On Fri, Aug 13, 2010 at 2:15 PM, John Criswell <criswell at illinois.edu>wrote:> aparna kotha wrote: > >> All, >> I have a ModulePass (A) calling a FunctionPass that inturn calls >> TargetData (a ModulePass). For reasons of code correctness and modularity I >> cannot reorganize my passes in any other way . >> When I use opt to load and run A , it gives the following error. >> LLVM ERROR: Bad TargetData ctor used. Tool did not specify a TargetData >> to use? >> >> >> I gather from some previous emails that this was not supported. Is it >> still not supported? and is there any way I can avoid this. >> > > For some reason, the TargetData pass must use a special constructor method > that gives it a reference to the module to be analyzed. This means that > declaring it as a dependency in your getAnalysisUsage() methods isn't > enough; whatever program is adding your passes to the PassManager must add > TargetData explicitly as one of the passes to run. > > The opt program does this automatically, so I'm assuming you're writing > your own tool that creates a PassManager and tells it to run some passes. > You want to add code like the following to your tool: > > PassManager Passes; // This line probably exists in your code already > > // Explicitly schedule the TargetData pass as the first pass to run; note > that M.get() gets a pointer or reference > // to the module to analyze > Passes.add(new TargetData(M.get())); > > -- John T. > > > > > >> >> >> >> >> Thanks and Regards >> >> >> Aparna Kotha >> Graduate Student University of Maryland, College Park >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100813/2cc68fa5/attachment.html>