Add isInsertSubreg property.
[oota-llvm.git] / lib / CodeGen / MachineBlockPlacement.cpp
index 891f605e2a1535eb91db9ceca12d7072b38b20a7..661a4e321aff7cbc0535288e96356ee1fed870ae 100644 (file)
@@ -42,6 +42,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetLowering.h"
+#include "llvm/Target/TargetSubtargetInfo.h"
 #include <algorithm>
 using namespace llvm;
 
@@ -264,19 +265,23 @@ INITIALIZE_PASS_END(MachineBlockPlacement, "block-placement2",
 ///
 /// Only used by debug logging.
 static std::string getBlockName(MachineBasicBlock *BB) {
-  string_ostream OS;
+  std::string Result;
+  raw_string_ostream OS(Result);
   OS << "BB#" << BB->getNumber()
      << " (derived from LLVM BB '" << BB->getName() << "')";
-  return OS.str();
+  OS.flush();
+  return Result;
 }
 
 /// \brief Helper to print the number of a MBB.
 ///
 /// Only used by debug logging.
 static std::string getBlockNum(MachineBasicBlock *BB) {
-  string_ostream OS;
+  std::string Result;
+  raw_string_ostream OS(Result);
   OS << "BB#" << BB->getNumber();
-  return OS.str();
+  OS.flush();
+  return Result;
 }
 #endif
 
@@ -1107,8 +1112,8 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &F) {
   MBPI = &getAnalysis<MachineBranchProbabilityInfo>();
   MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
   MLI = &getAnalysis<MachineLoopInfo>();
-  TII = F.getTarget().getInstrInfo();
-  TLI = F.getTarget().getTargetLowering();
+  TII = F.getSubtarget().getInstrInfo();
+  TLI = F.getSubtarget().getTargetLowering();
   assert(BlockToChain.empty());
 
   buildCFGChains(F);