[LLVMdev] Question about MachineFunction Pass

Zhang Qiuyu qiuyu at ucla.edu
Tue Oct 19 00:00:34 PDT 2004


Hi,

I wrote a machinefunction pass to try to see what's going on. Does it mean that it is target machine dependent pass, like x86? However, after compile it, I found there wasnot command option I registered. I used regular way to do it like RegisterOpt <...> X("... ", "... "), but I cannot see the optimized option when I use opt -load ../../lib/Debug/libxxx.so --help. And from LLVM source code, I saw some passes use runOnMachineFunction(MachineFunction &MF), but there is no API like registerOpt. what does it mean? Thanks

For MachineFunction pass, the doc says it is not allowed to do any of the following:
  1.. Modify any LLVM Instructions, BasicBlocks or Functions.
  2.. Modify a MachineFunction other than the one currently being processed.
  3.. Add or remove MachineFunctions from the current Module.
  4.. Add or remove global variables from the current Module.
  5.. Maintain state across invocations of runOnMachineFunction (including global data)
It seems I cannot insert some instructions, right?

For MachineInstr.h and MachineInstrBuilder.h and X86InstrBuilder.h, I am just wondering if we can construct some X86 assemble instruction? if so, can we insert the X86 assemble instruction to bytecode( bytecode is IR code which should be conflicted with X86 asm) if I used runOnMachineFunction pass ? 






More information about the llvm-dev mailing list