[llvm-commits] CVS: llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp
Misha Brukman
brukman at cs.uiuc.edu
Mon Oct 28 14:01:02 PST 2002
Changes in directory llvm/lib/CodeGen/PostOpts:
PeepholeOpts.cpp updated: 1.3 -> 1.4
---
Log message:
Replaced uses of deprecated `MachineFunction::get(BasicBlock *BB)'.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp
diff -u llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp:1.3 llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp:1.4
--- llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp:1.3 Sun Oct 27 19:41:22 2002
+++ llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp Mon Oct 28 14:00:31 2002
@@ -6,7 +6,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/PeepholeOpts.h"
-#include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/MachineInstrInfo.h"
@@ -100,7 +100,16 @@
PeepholeOpts::runOnBasicBlock(BasicBlock &BB)
{
// Get the machine instructions for this BB
- MachineBasicBlock& mvec = MachineBasicBlock::get(&BB);
+ // FIXME: MachineBasicBlock::get() is deprecated, hence inlining the function
+ const Function *F = BB.getParent();
+ MachineFunction &MF = MachineFunction::get(F);
+ MachineBasicBlock *MBB = NULL;
+ for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
+ if (I->getBasicBlock() == &BB)
+ MBB = I;
+ }
+ assert(MBB && "MachineBasicBlock object not found for specified block!");
+ MachineBasicBlock &mvec = *MBB;
// Iterate over all machine instructions in the BB
// Use a reverse iterator to allow deletion of MI or any instruction after it.
More information about the llvm-commits
mailing list