Registering a MachineFunctionPass to JIT codegen

Hi all,

I can't find a way to add a MachineFunctionPass to the common codegen passes (LLVMTargetMachine::addPassesToEmitMachineCode) while JITting (the pass manager is associated with the jitstate of the JIT and I can't access it because it's private). Have I missed something? Or adding a MachineFunctionPass to codegen requires to change the LLVMTargetMachine::addPassesToEmitMachineCode function?

Thanks,
Nicolas

You haven't missed anything, there isn't currently a way to do this.

-Chris

Hi Chris,

Chris Lattner wrote:

You haven't missed anything, there isn't currently a way to do this.

Good to know. Anything against making the codegen pass manager accessible to users? Something like ExecutionEngine::getCommonCodegenPassManager() ?

Thanks,
Nicolas

I don't have a problem with that, the interface should be discussed though. You'd want some sort of interface to say "stick this in the 'before regalloc' bucket" etc.

What do you intend to use this for?

-Chris

Chris Lattner wrote:

Something like
ExecutionEngine::getCommonCodegenPassManager() ?

I don't have a problem with that, the interface should be discussed though. You'd want some sort of interface to say "stick this in the 'before regalloc' bucket" etc.

What do you intend to use this for?

Actually, we can forget about that in my particular case. I wanted to add a pass that gathers the GC information (the GCFunctionInfo object) provided by the GCMachineCodeAnalysis pass. However, I didn't realize the GCStrategy already has a link to the GCFunctionInfos. So creating an interface is not needed anymore for my particular case.

Thanks,
Nicolas