[LLVMdev] Enumerating machine functions

Lorenzo De Carli lorenzo at cs.wisc.edu
Tue Apr 5 14:47:42 PDT 2011

Hi Duncan,

thanks for your reply. So if I understand correctly MachineFunction
objects are converted to machine code one at a time, and each object
is "thrown away" after having been converted. Seems that the only way
to achieve what I have in mind is to write the machine code for all
the functions to a file, and then load it and process it in a separate
tool (possibly based on LLVM-mc). Is this correct?


On Sat, Apr 2, 2011 at 2:19 AM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Lorenzo,
>> I have a doubt about running passes on machine code. We are
>> implementing a transformation on machine code that consists in
>> analyzing a series of functions, extracting some aggregate properties,
>> and then using the extracted information to optimize each functions.
>> I am not familiar with LLVM internals, so I am not sure how to
>> implement each step. From the documentation, it seems that the only
>> way to work on the machine-dependent representation is to write a
>> MachineFunctionPass. However, such pass would be run separately on
>> every function, while what we need is pretty much a ModulePass running
>> on machine code, or some way to enumerate all the MachineFunction
>> objects. Is there any way to achieve this?
> one of the design goals of LLVM codegen is to be able to codegen one function
> at a time, so the front-end can generate a function, codegen it, then throw
> away the function before moving onto the next function.
> Ciao, Duncan.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list