diff options
author | Alp Toker <alp@nuanti.com> | 2014-06-26 22:52:05 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-06-26 22:52:05 +0000 |
commit | 8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d (patch) | |
tree | 7da91c52380a71a92a895b0c172ae28b83fb6011 /lib/CodeGen | |
parent | eca517deaa890b1658ed0452704f398ce80e47b8 (diff) | |
download | llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.gz llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.bz2 llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.xz |
Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 12 | ||||
-rw-r--r-- | lib/CodeGen/MachineBlockFrequencyInfo.cpp | 7 | ||||
-rw-r--r-- | lib/CodeGen/MachineBlockPlacement.cpp | 12 | ||||
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 5 | ||||
-rw-r--r-- | lib/CodeGen/MachineScheduler.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/ScheduleDAGInstrs.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/TargetSchedule.cpp | 9 |
10 files changed, 38 insertions, 22 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index ebb49c34a7..799ee92d3a 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1585,7 +1585,8 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) { // Otherwise report the problem to the user. { - string_ostream OS; + std::string S; + raw_string_ostream OS(S); OS << "Unsupported expression in static initializer: "; CE->printAsOperand(OS, /*PrintType=*/false, !AP.MF ? nullptr : AP.MF->getFunction()->getParent()); diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 01f26d0c4c..46ee0c856b 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -241,7 +241,8 @@ static void EmitMSInlineAsmStr(const char *AsmStr, const MachineInstr *MI, } } if (Error) { - string_ostream Msg; + std::string msg; + raw_string_ostream Msg(msg); Msg << "invalid operand in inline asm: '" << AsmStr << "'"; MMI->getModule()->getContext().emitError(LocCookie, Msg.str()); } @@ -412,7 +413,8 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI, } } if (Error) { - string_ostream Msg; + std::string msg; + raw_string_ostream Msg(msg); Msg << "invalid operand in inline asm: '" << AsmStr << "'"; MMI->getModule()->getContext().emitError(LocCookie, Msg.str()); } @@ -469,7 +471,8 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const { // Emit the inline asm to a temporary string so we can emit it through // EmitInlineAsm. - small_string_ostream<256> OS; + SmallString<256> StringData; + raw_svector_ostream OS(StringData); // The variant of the current asmprinter. int AsmPrinterVariant = MAI->getAssemblerDialect(); @@ -514,7 +517,8 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, raw_ostream &OS, } OS << Counter; } else { - string_ostream Msg; + std::string msg; + raw_string_ostream Msg(msg); Msg << "Unknown special formatter '" << Code << "' for machine instr: " << *MI; report_fatal_error(Msg.str()); diff --git a/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/lib/CodeGen/MachineBlockFrequencyInfo.cpp index 35e4a56cec..9151d99089 100644 --- a/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -89,9 +89,10 @@ struct DOTGraphTraits<MachineBlockFrequencyInfo*> : std::string getNodeLabel(const MachineBasicBlock *Node, const MachineBlockFrequencyInfo *Graph) { - string_ostream OS; + std::string Result; + raw_string_ostream OS(Result); - OS << Node->getName() << ":"; + OS << Node->getName().str() << ":"; switch (ViewMachineBlockFreqPropagationDAG) { case GVDT_Fraction: Graph->printBlockFreq(OS, Node); @@ -104,7 +105,7 @@ struct DOTGraphTraits<MachineBlockFrequencyInfo*> : "never reach this point."); } - return OS.str(); + return Result; } }; diff --git a/lib/CodeGen/MachineBlockPlacement.cpp b/lib/CodeGen/MachineBlockPlacement.cpp index 891f605e2a..74af1e2d64 100644 --- a/lib/CodeGen/MachineBlockPlacement.cpp +++ b/lib/CodeGen/MachineBlockPlacement.cpp @@ -264,19 +264,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 diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 20210adf30..6138aef4ad 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -465,8 +465,9 @@ MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx, const char *Prefix = isLinkerPrivate ? DL->getLinkerPrivateGlobalPrefix() : DL->getPrivateGlobalPrefix(); - small_string_ostream<60> Name; - Name << Prefix << "JTI" << getFunctionNumber() << '_' << JTI; + SmallString<60> Name; + raw_svector_ostream(Name) + << Prefix << "JTI" << getFunctionNumber() << '_' << JTI; return Ctx.GetOrCreateSymbol(Name.str()); } diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp index f7459bbf6f..0baf2a6c1c 100644 --- a/lib/CodeGen/MachineScheduler.cpp +++ b/lib/CodeGen/MachineScheduler.cpp @@ -3235,7 +3235,8 @@ struct DOTGraphTraits<ScheduleDAGMI*> : public DefaultDOTGraphTraits { } static std::string getNodeLabel(const SUnit *SU, const ScheduleDAG *G) { - string_ostream SS; + std::string Str; + raw_string_ostream SS(Str); const ScheduleDAGMI *DAG = static_cast<const ScheduleDAGMI*>(G); const SchedDFSResult *DFS = DAG->hasVRegLiveness() ? static_cast<const ScheduleDAGMILive*>(G)->getDFSResult() : nullptr; diff --git a/lib/CodeGen/ScheduleDAGInstrs.cpp b/lib/CodeGen/ScheduleDAGInstrs.cpp index baf4af6aba..92a9a30f24 100644 --- a/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -1197,7 +1197,8 @@ void ScheduleDAGInstrs::dumpNode(const SUnit *SU) const { } std::string ScheduleDAGInstrs::getGraphNodeLabel(const SUnit *SU) const { - string_ostream oss; + std::string s; + raw_string_ostream oss(s); if (SU == &EntrySU) oss << "<entry>"; else if (SU == &ExitSU) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index a2cc290816..57e22e21c3 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3245,7 +3245,8 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable, void SelectionDAGISel::CannotYetSelect(SDNode *N) { - string_ostream Msg; + std::string msg; + raw_string_ostream Msg(msg); Msg << "Cannot select: "; if (N->getOpcode() != ISD::INTRINSIC_W_CHAIN && diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index 680a7ec5dd..4df5ede388 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -268,7 +268,8 @@ void SelectionDAG::setSubgraphColor(SDNode *N, const char *Color) { } std::string ScheduleDAGSDNodes::getGraphNodeLabel(const SUnit *SU) const { - string_ostream O; + std::string s; + raw_string_ostream O(s); O << "SU(" << SU->NodeNum << "): "; if (SU->getNode()) { SmallVector<SDNode *, 4> GluedNodes; diff --git a/lib/CodeGen/TargetSchedule.cpp b/lib/CodeGen/TargetSchedule.cpp index d18a514a85..b0f2ca6888 100644 --- a/lib/CodeGen/TargetSchedule.cpp +++ b/lib/CodeGen/TargetSchedule.cpp @@ -212,10 +212,11 @@ unsigned TargetSchedModel::computeOperandLatency( if (SCDesc->isValid() && !DefMI->getOperand(DefOperIdx).isImplicit() && !DefMI->getDesc().OpInfo[DefOperIdx].isOptionalDef() && SchedModel.isComplete()) { - string_ostream Err; - Err << "DefIdx " << DefIdx << " exceeds machine model writes for " - << *DefMI; - report_fatal_error(Err.str()); + std::string Err; + raw_string_ostream ss(Err); + ss << "DefIdx " << DefIdx << " exceeds machine model writes for " + << *DefMI; + report_fatal_error(ss.str()); } #endif // FIXME: Automatically giving all implicit defs defaultDefLatency is |