[LLVMdev] How do you add MachineBlockPlacement to a Function Pass Manager?

greatwolf llvm.greatwolf at mamber.net
Thu Sep 19 13:46:03 PDT 2013

I'm trying to port llvm-lua so it's buildable with llvm trunk. A problem I'm
running into is that it uses the older BlockPlacement pass. From searching
around and reading llvm's commit, this pass has been replaced and superseded
by Chandler's MachineBlockPlacement pass.

What's unclear to me is how exactly do you add this pass to say a function
pass manager?

The current llvm-lua code has something like this:

    // ...
    if(OptLevel > 1) {
      TheFPM = new llvm::FunctionPassManager(M);
    // add some passes for opt1
    // ...
      if(OptLevel > 2) {
        // BlockPlacement
        // Reassociate expressions.
    // etc ...

It looks like llvm actually had a `createMachineBlockPlacementPass` once a
upon a time. But that was removed and refactored by atrick #150100. It now
just has a

    extern char &MachineBlockPlacementID;

in Passes.h instead.

I'm /very/ new to llvm and only started looking at it a few days ago. After
exhaustively checking through the doc, I still cannot find any example or
explanation on how to do this.

If there's no corresponding `create*Pass` for a given pass how would you add
it to a manager? Is there some way to add that pass via ID or are they not
meant to be added this way?

View this message in context: http://llvm.1065342.n5.nabble.com/How-do-you-add-MachineBlockPlacement-to-a-Function-Pass-Manager-tp61351.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.

More information about the llvm-dev mailing list