[LLVMdev] WG: Constraints of MachineFunctionPasses

Czurda Christoph Christoph.Czurda.fl at ait.ac.at
Tue Jun 9 09:15:36 PDT 2015


After some experiments I think it works like this: A pass is not allowed to maintain any pointers or references to llvm Codegen or IR objects, such as MachineFunction*, MachineInstr*, and so on. Of course it is allowed to maintain other objects, for example objects from the standard library, in its state. Can someone confirm that please?

Von: Czurda Christoph
Gesendet: Dienstag, 9. Juni 2015 15:00
An: 'llvmdev at cs.uiuc.edu'
Betreff: Constraints of MachineFunctionPasses

Hello,

I'm having troubles understanding the requirements for machine function passes: http://llvm.org/releases/3.4/docs/WritingAnLLVMPass.html#the-machinefunctionpass-class
It says that they are not allowed to "Maintain state across invocations of runOnMachineFunction (including global data)."

However, doesn't for example the LiveVariables Pass do exactly that? Besides, how should an analysis pass be of any use if it's not allowed to build up data structures that persist after the pass has been run?

What I actually want to do is to remember for each function call, which physical registers are live at the time of the call. Therefore I want to fill a map that contains functions as keys and lists of registers as values. Wouldn't a machine function pass be the natural solution to this?

Best regards,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150609/2a191b41/attachment.html>


More information about the llvm-dev mailing list