diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-02-29 20:31:09 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-02-29 20:31:09 +0000 |
commit | 42fcf81aba771814453b22a258418d51bf758c5a (patch) | |
tree | a5dbcfc2c6f00788de8b06acdc9d2e9c49057391 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 60df263f54fc9bcf4253e1559362b5bbde2ac2fb (diff) | |
download | bcm5719-llvm-42fcf81aba771814453b22a258418d51bf758c5a.tar.gz bcm5719-llvm-42fcf81aba771814453b22a258418d51bf758c5a.zip |
BitstreamWriter: Change primary output buffer to be a SmallVector instead of an
std::vector.
- Good for 1-2% speedup on writing PCH for Cocoa.h.
- Clang side API match to follow shortly, there wasn't an easy way to make this
non-breaking.
llvm-svn: 151750
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index c6c7fb7dcb2..93769906801 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1774,8 +1774,7 @@ enum { DarwinBCHeaderSize = 5*4 }; -static void WriteInt32ToBuffer(uint32_t Value, - std::vector<unsigned char> &Buffer, +static void WriteInt32ToBuffer(uint32_t Value, SmallVectorImpl<char> &Buffer, uint32_t &Position) { Buffer[Position + 0] = (unsigned char) (Value >> 0); Buffer[Position + 1] = (unsigned char) (Value >> 8); @@ -1784,7 +1783,7 @@ static void WriteInt32ToBuffer(uint32_t Value, Position += 4; } -static void EmitDarwinBCHeaderAndTrailer(std::vector<unsigned char> &Buffer, +static void EmitDarwinBCHeaderAndTrailer(SmallVectorImpl<char> &Buffer, const Triple &TT) { unsigned CPUType = ~0U; @@ -1833,7 +1832,7 @@ static void EmitDarwinBCHeaderAndTrailer(std::vector<unsigned char> &Buffer, /// WriteBitcodeToFile - Write the specified module to the specified output /// stream. void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out) { - std::vector<unsigned char> Buffer; + SmallVector<char, 1024> Buffer; Buffer.reserve(256*1024); // If this is darwin or another generic macho target, reserve space for the |