diff options
author | Stephen Hines <srhines@google.com> | 2014-04-23 16:57:46 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-04-24 15:53:16 -0700 |
commit | 36b56886974eae4f9c5ebc96befd3e7bfe5de338 (patch) | |
tree | e6cfb69fbbd937f450eeb83bfb83b9da3b01275a /include/llvm/Bitcode | |
parent | 69a8640022b04415ae9fac62f8ab090601d8f889 (diff) | |
download | external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.zip external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.gz external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.bz2 |
Update to LLVM 3.5a.
Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r-- | include/llvm/Bitcode/BitcodeWriterPass.h | 51 | ||||
-rw-r--r-- | include/llvm/Bitcode/BitstreamReader.h | 3 | ||||
-rw-r--r-- | include/llvm/Bitcode/BitstreamWriter.h | 2 | ||||
-rw-r--r-- | include/llvm/Bitcode/LLVMBitCodes.h | 3 | ||||
-rw-r--r-- | include/llvm/Bitcode/ReaderWriter.h | 27 |
5 files changed, 65 insertions, 21 deletions
diff --git a/include/llvm/Bitcode/BitcodeWriterPass.h b/include/llvm/Bitcode/BitcodeWriterPass.h new file mode 100644 index 0000000..898cd52 --- /dev/null +++ b/include/llvm/Bitcode/BitcodeWriterPass.h @@ -0,0 +1,51 @@ +//===-- BitcodeWriterPass.h - Bitcode writing pass --------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// This file provides a bitcode writing pass. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_BITCODE_BITCODE_WRITER_PASS_H +#define LLVM_BITCODE_BITCODE_WRITER_PASS_H + +#include "llvm/ADT/StringRef.h" + +namespace llvm { +class Module; +class ModulePass; +class raw_ostream; +class PreservedAnalyses; + +/// \brief Create and return a pass that writes the module to the specified +/// ostream. Note that this pass is designed for use with the legacy pass +/// manager. +ModulePass *createBitcodeWriterPass(raw_ostream &Str); + +/// \brief Pass for writing a module of IR out to a bitcode file. +/// +/// Note that this is intended for use with the new pass manager. To construct +/// a pass for the legacy pass manager, use the function above. +class BitcodeWriterPass { + raw_ostream &OS; + +public: + /// \brief Construct a bitcode writer pass around a particular output stream. + explicit BitcodeWriterPass(raw_ostream &OS) : OS(OS) {} + + /// \brief Run the bitcode writer pass, and output the module to the selected + /// output stream. + PreservedAnalyses run(Module *M); + + static StringRef name() { return "BitcodeWriterPass"; } +}; + +} + +#endif diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h index dc5e095..fcbf426 100644 --- a/include/llvm/Bitcode/BitstreamReader.h +++ b/include/llvm/Bitcode/BitstreamReader.h @@ -15,7 +15,6 @@ #ifndef LLVM_BITCODE_BITSTREAMREADER_H #define LLVM_BITCODE_BITSTREAMREADER_H -#include "llvm/ADT/OwningPtr.h" #include "llvm/Bitcode/BitCodes.h" #include "llvm/Support/Endian.h" #include "llvm/Support/StreamableMemoryObject.h" @@ -44,7 +43,7 @@ public: std::vector<std::pair<unsigned, std::string> > RecordNames; }; private: - OwningPtr<StreamableMemoryObject> BitcodeBytes; + std::unique_ptr<StreamableMemoryObject> BitcodeBytes; std::vector<BlockInfo> BlockInfoRecords; diff --git a/include/llvm/Bitcode/BitstreamWriter.h b/include/llvm/Bitcode/BitstreamWriter.h index f40a0d1..ef88a88 100644 --- a/include/llvm/Bitcode/BitstreamWriter.h +++ b/include/llvm/Bitcode/BitstreamWriter.h @@ -97,7 +97,7 @@ public: : Out(O), CurBit(0), CurValue(0), CurCodeSize(2) {} ~BitstreamWriter() { - assert(CurBit == 0 && "Unflused data remaining"); + assert(CurBit == 0 && "Unflushed data remaining"); assert(BlockScope.empty() && CurAbbrevs.empty() && "Block imbalance"); // Free the BlockInfoRecords. diff --git a/include/llvm/Bitcode/LLVMBitCodes.h b/include/llvm/Bitcode/LLVMBitCodes.h index b3d2466..7e6831b 100644 --- a/include/llvm/Bitcode/LLVMBitCodes.h +++ b/include/llvm/Bitcode/LLVMBitCodes.h @@ -370,7 +370,8 @@ namespace bitc { ATTR_KIND_Z_EXT = 34, ATTR_KIND_BUILTIN = 35, ATTR_KIND_COLD = 36, - ATTR_KIND_OPTIMIZE_NONE = 37 + ATTR_KIND_OPTIMIZE_NONE = 37, + ATTR_KIND_IN_ALLOCA = 38 }; } // End bitc namespace diff --git a/include/llvm/Bitcode/ReaderWriter.h b/include/llvm/Bitcode/ReaderWriter.h index 78f40ca..0918e92 100644 --- a/include/llvm/Bitcode/ReaderWriter.h +++ b/include/llvm/Bitcode/ReaderWriter.h @@ -14,6 +14,7 @@ #ifndef LLVM_BITCODE_READERWRITER_H #define LLVM_BITCODE_READERWRITER_H +#include "llvm/Support/ErrorOr.h" #include <string> namespace llvm { @@ -25,14 +26,11 @@ namespace llvm { class ModulePass; class raw_ostream; - /// getLazyBitcodeModule - Read the header of the specified bitcode buffer - /// and prepare for lazy deserialization of function bodies. If successful, - /// this takes ownership of 'buffer' and returns a non-null pointer. On - /// error, this returns null, *does not* take ownership of Buffer, and fills - /// in *ErrMsg with an error description if ErrMsg is non-null. - Module *getLazyBitcodeModule(MemoryBuffer *Buffer, - LLVMContext &Context, - std::string *ErrMsg = 0); + /// Read the header of the specified bitcode buffer and prepare for lazy + /// deserialization of function bodies. If successful, this takes ownership + /// of 'buffer. On error, this *does not* take ownership of Buffer. + ErrorOr<Module *> getLazyBitcodeModule(MemoryBuffer *Buffer, + LLVMContext &Context); /// getStreamedBitcodeModule - Read the header of the specified stream /// and prepare for lazy deserialization and streaming of function bodies. @@ -52,21 +50,16 @@ namespace llvm { LLVMContext &Context, std::string *ErrMsg = 0); - /// ParseBitcodeFile - Read the specified bitcode file, returning the module. - /// If an error occurs, this returns null and fills in *ErrMsg if it is - /// non-null. This method *never* takes ownership of Buffer. - Module *ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext &Context, - std::string *ErrMsg = 0); + /// Read the specified bitcode file, returning the module. + /// This method *never* takes ownership of Buffer. + ErrorOr<Module *> parseBitcodeFile(MemoryBuffer *Buffer, + LLVMContext &Context); /// WriteBitcodeToFile - Write the specified module to the specified /// raw output stream. For streams where it matters, the given stream /// should be in "binary" mode. void WriteBitcodeToFile(const Module *M, raw_ostream &Out); - /// createBitcodeWriterPass - Create and return a pass that writes the module - /// to the specified ostream. - ModulePass *createBitcodeWriterPass(raw_ostream &Str); - /// isBitcodeWrapper - Return true if the given bytes are the magic bytes /// for an LLVM IR bitcode wrapper. |