aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-29 03:04:22 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-29 03:04:22 +0000
commit95db93caa1130725123eb50479d0c51c09e8a2f4 (patch)
tree5d25abf46f5296cb1d3e602a25a7da89a2707de8
parent5657c01949dca6c012ac60d242d1a8d2ffdf5603 (diff)
downloadexternal_llvm-95db93caa1130725123eb50479d0c51c09e8a2f4.zip
external_llvm-95db93caa1130725123eb50479d0c51c09e8a2f4.tar.gz
external_llvm-95db93caa1130725123eb50479d0c51c09e8a2f4.tar.bz2
Revert r77397, it causes significant regressions in llc performance.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77425 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/FormattedStream.h18
-rw-r--r--lib/Support/FormattedStream.cpp13
2 files changed, 13 insertions, 18 deletions
diff --git a/include/llvm/Support/FormattedStream.h b/include/llvm/Support/FormattedStream.h
index a8300b4..4b13ff2 100644
--- a/include/llvm/Support/FormattedStream.h
+++ b/include/llvm/Support/FormattedStream.h
@@ -49,13 +49,13 @@ namespace llvm
///
bool DeleteStream;
- /// ColumnFlushed - The current output column of the data that's
- /// been flushed. The column scheme is zero-based.
+ /// Column - The current output column of the stream. The column
+ /// scheme is zero-based.
///
- unsigned ColumnFlushed;
+ unsigned Column;
virtual void write_impl(const char *Ptr, size_t Size) {
- ComputeColumn(ColumnFlushed);
+ ComputeColumn(Ptr, Size);
TheStream->write(Ptr, Size);
}
@@ -67,10 +67,10 @@ namespace llvm
return TheStream->tell() - TheStream->GetNumBytesInBuffer();
}
- /// ComputeColumn - Examine the current buffer and figure out
- /// which column we're in.
+ /// ComputeColumn - Examine the current output and figure out
+ /// which column we end up in after output.
///
- void ComputeColumn(unsigned &Column);
+ void ComputeColumn(const char *Ptr, size_t Size);
public:
/// formatted_raw_ostream - Open the specified file for
@@ -84,11 +84,11 @@ namespace llvm
/// underneath it.
///
formatted_raw_ostream(raw_ostream &Stream, bool Delete = false)
- : raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) {
+ : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {
setStream(Stream, Delete);
}
explicit formatted_raw_ostream()
- : raw_ostream(), TheStream(0), DeleteStream(false), ColumnFlushed(0) {}
+ : raw_ostream(), TheStream(0), DeleteStream(false), Column(0) {}
~formatted_raw_ostream() {
if (DeleteStream)
diff --git a/lib/Support/FormattedStream.cpp b/lib/Support/FormattedStream.cpp
index 1198ebf..1796f9f 100644
--- a/lib/Support/FormattedStream.cpp
+++ b/lib/Support/FormattedStream.cpp
@@ -19,11 +19,11 @@ using namespace llvm;
/// ComputeColumn - Examine the current output and figure out which
/// column we end up in after output.
///
-void formatted_raw_ostream::ComputeColumn(unsigned &Column) {
+void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) {
// Keep track of the current column by scanning the string for
// special characters
- for (const char *Ptr = begin(); Ptr != end(); ++Ptr) {
+ for (const char *epos = Ptr + Size; Ptr != epos; ++Ptr) {
++Column;
if (*Ptr == '\n' || *Ptr == '\r')
Column = 0;
@@ -38,13 +38,8 @@ void formatted_raw_ostream::ComputeColumn(unsigned &Column) {
/// \param MinPad - The minimum space to give after the most recent
/// I/O, even if the current column + minpad > newcol.
///
-void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) {
- // Start out from the last flush position.
- unsigned Column = ColumnFlushed;
-
- // Now figure out what's in the buffer and add it to the column
- // count.
- ComputeColumn(Column);
+void formatted_raw_ostream::PadToColumn(unsigned NewCol, unsigned MinPad) {
+ flush();
// Output spaces until we reach the desired column.
unsigned num = NewCol - Column;