gohman at apple.com
Mon Nov 9 13:49:57 CST 2009
On Nov 6, 2009, at 5:43 PM, Sumesh Udayakumaran wrote:
> I have a ModulePass in LLC that runs after most of codegen completes,
> right before OBJ emission. I want the ModulePass to iterate over all
> MachineFunctions, emulating them. I used to do this by iterating over
> all Module Function's, and using MachineFunction::get() to get the
> MachineFunction associated with said Function.
> In LLVM 2.6, MachineFunction::get() is gone. What is the new way of
> doing what I need?
CodeGen doesn't attempt to keep the MachineFunctions for all the
Functions allocated at the same time. Looking back at 2.5, it seems
it may have been possible to get CodeGen to do this, though it was
MachineFunctions are now allocated and deallocated with the
MachineFunctionAnalysis pass. It's very straight-forward; it's just
a FunctionPass which allocates a new MachineFunction in its
runOnFunction and deallocates it in its releaseMemory. You may
be able to change it to fit your needs.
More information about the LLVMdev