#define BITSTREAM_WRITER_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Bitcode/BitCodes.h"
#include <vector>
namespace llvm {
class BitstreamWriter {
- std::vector<unsigned char> &Out;
+ SmallVectorImpl<char> &Out;
/// CurBit - Always between 0 and 31 inclusive, specifies the next bit to use.
unsigned CurBit;
}
public:
- explicit BitstreamWriter(std::vector<unsigned char> &O)
+ explicit BitstreamWriter(SmallVectorImpl<char> &O)
: Out(O), CurBit(0), CurValue(0), CurCodeSize(2) {}
~BitstreamWriter() {
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);
Position += 4;
}
-static void EmitDarwinBCHeaderAndTrailer(std::vector<unsigned char> &Buffer,
+static void EmitDarwinBCHeaderAndTrailer(SmallVectorImpl<char> &Buffer,
const Triple &TT) {
unsigned CPUType = ~0U;
/// 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