greatwolf
2013-Sep-19 20:46 UTC
[LLVMdev] How do you add MachineBlockPlacement to a Function Pass Manager?
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 TheFPM->add(llvm::createBlockPlacementPass()); // Reassociate expressions. TheFPM->add(llvm::createReassociatePass()); // 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.
Andrew Trick
2013-Sep-24 07:57 UTC
[LLVMdev] How do you add MachineBlockPlacement to a Function Pass Manager?
On Sep 19, 2013, at 1:46 PM, greatwolf <llvm.greatwolf at mamber.net> wrote:> 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 > TheFPM->add(llvm::createBlockPlacementPass()); > // Reassociate expressions. > TheFPM->add(llvm::createReassociatePass()); > // 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?Pass::createPass(ID) can instantiate a pass from its ID. But you don't want to create a MachineFunctionPass at this point in your pipeline. Machine passes are configured within TargetPassConfig, which is probably not something you need to meddle with. I think you're looking at an old IR-level block placement that is now obsolete. I don't remember when it was removed, but it should be safe to ignore. -Andy
Reasonably Related Threads
- [CodeGen] CodeSize - TailMerging and BlockPlacement
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
- [LLVMdev] Question on JIT optimizations
- [LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
- [LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)