aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 21:41:43 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 21:41:43 +0000
commite0c86afac63a2dbbcff0ad79ed7b93d860451385 (patch)
tree8ba402a9b827bd77895c515e31c4ae17c5ef9346
parentb683ea4712836e22b98d24bf8e40e599224d024e (diff)
Switch SubtargetFeature off of ostreams
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79864 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/SubtargetFeature.h7
-rw-r--r--lib/Target/SubtargetFeature.cpp45
2 files changed, 23 insertions, 29 deletions
diff --git a/include/llvm/Target/SubtargetFeature.h b/include/llvm/Target/SubtargetFeature.h
index 5cfdc023d4..58333e2b42 100644
--- a/include/llvm/Target/SubtargetFeature.h
+++ b/include/llvm/Target/SubtargetFeature.h
@@ -20,12 +20,12 @@
#include <string>
#include <vector>
-#include <iosfwd>
#include <cstring>
#include "llvm/Support/DataTypes.h"
namespace llvm {
-
+ class raw_ostream;
+
//===----------------------------------------------------------------------===//
///
/// SubtargetFeatureKV - Used to provide key value pairs for feature and
@@ -102,8 +102,7 @@ public:
void *getInfo(const SubtargetInfoKV *Table, size_t TableSize);
/// Print feature string.
- void print(std::ostream &OS) const;
- void print(std::ostream *OS) const { if (OS) print(*OS); }
+ void print(raw_ostream &OS) const;
// Dump feature info.
void dump() const;
diff --git a/lib/Target/SubtargetFeature.cpp b/lib/Target/SubtargetFeature.cpp
index f9370256c6..664a43cbcc 100644
--- a/lib/Target/SubtargetFeature.cpp
+++ b/lib/Target/SubtargetFeature.cpp
@@ -12,10 +12,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/Target/SubtargetFeature.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/Streams.h"
#include <algorithm>
-#include <ostream>
#include <cassert>
#include <cctype>
using namespace llvm;
@@ -145,22 +144,22 @@ static void Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
unsigned MaxFeatLen = getLongestEntryLength(FeatTable, FeatTableSize);
// Print the CPU table.
- cerr << "Available CPUs for this target:\n\n";
+ errs() << "Available CPUs for this target:\n\n";
for (size_t i = 0; i != CPUTableSize; i++)
- cerr << " " << CPUTable[i].Key
+ errs() << " " << CPUTable[i].Key
<< std::string(MaxCPULen - std::strlen(CPUTable[i].Key), ' ')
<< " - " << CPUTable[i].Desc << ".\n";
- cerr << "\n";
+ errs() << "\n";
// Print the Feature table.
- cerr << "Available features for this target:\n\n";
+ errs() << "Available features for this target:\n\n";
for (size_t i = 0; i != FeatTableSize; i++)
- cerr << " " << FeatTable[i].Key
+ errs() << " " << FeatTable[i].Key
<< std::string(MaxFeatLen - std::strlen(FeatTable[i].Key), ' ')
<< " - " << FeatTable[i].Desc << ".\n";
- cerr << "\n";
+ errs() << "\n";
- cerr << "Use +feature to enable a feature, or -feature to disable it.\n"
+ errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
<< "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
exit(1);
}
@@ -283,10 +282,9 @@ uint32_t SubtargetFeatures::getBits(const SubtargetFeatureKV *CPUTable,
SetImpliedBits(Bits, &FE, FeatureTable, FeatureTableSize);
}
} else {
- cerr << "'" << Features[0]
- << "' is not a recognized processor for this target"
- << " (ignoring processor)"
- << "\n";
+ errs() << "'" << Features[0]
+ << "' is not a recognized processor for this target"
+ << " (ignoring processor)\n";
}
// Iterate through each feature
for (size_t i = 1; i < Features.size(); i++) {
@@ -314,10 +312,9 @@ uint32_t SubtargetFeatures::getBits(const SubtargetFeatureKV *CPUTable,
ClearImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);
}
} else {
- cerr << "'" << Feature
- << "' is not a recognized feature for this target"
- << " (ignoring feature)"
- << "\n";
+ errs() << "'" << Feature
+ << "' is not a recognized feature for this target"
+ << " (ignoring feature)\n";
}
}
@@ -340,25 +337,23 @@ void *SubtargetFeatures::getInfo(const SubtargetInfoKV *Table,
if (Entry) {
return Entry->Value;
} else {
- cerr << "'" << Features[0]
- << "' is not a recognized processor for this target"
- << " (ignoring processor)"
- << "\n";
+ errs() << "'" << Features[0]
+ << "' is not a recognized processor for this target"
+ << " (ignoring processor)\n";
return NULL;
}
}
/// print - Print feature string.
///
-void SubtargetFeatures::print(std::ostream &OS) const {
- for (size_t i = 0; i < Features.size(); i++) {
+void SubtargetFeatures::print(raw_ostream &OS) const {
+ for (size_t i = 0, e = Features.size(); i != e; ++i)
OS << Features[i] << " ";
- }
OS << "\n";
}
/// dump - Dump feature info.
///
void SubtargetFeatures::dump() const {
- print(*cerr.stream());
+ print(errs());
}