Home | History | Annotate | Download | only in BitReader_3_0
      1 //===- BitReader_3_0.h - Internal BitcodeReader 3.0 impl --------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This header defines the BitcodeReader class.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef BITREADER_3_0_H
     15 #define BITREADER_3_0_H
     16 
     17 #include "llvm/ADT/DenseMap.h"
     18 #include "llvm/Bitcode/BitstreamReader.h"
     19 #include "llvm/Bitcode/LLVMBitCodes.h"
     20 #include "llvm/IR/Attributes.h"
     21 #include "llvm/IR/DiagnosticInfo.h"
     22 #include "llvm/IR/GVMaterializer.h"
     23 #include "llvm/IR/OperandTraits.h"
     24 #include "llvm/IR/Type.h"
     25 #include "llvm/IR/ValueHandle.h"
     26 #include "llvm/Support/ErrorOr.h"
     27 #include <string>
     28 
     29 namespace llvm {
     30   class LLVMContext;
     31   class MemoryBuffer;
     32   class MemoryBufferRef;
     33   class Module;
     34 } // End llvm namespace
     35 
     36 namespace llvm_3_0 {
     37 
     38 using llvm::DiagnosticHandlerFunction;
     39 using llvm::LLVMContext;
     40 using llvm::MemoryBuffer;
     41 using llvm::MemoryBufferRef;
     42 
     43 
     44   /// Read the header of the specified bitcode buffer and prepare for lazy
     45   /// deserialization of function bodies.  If successful, this moves Buffer. On
     46   /// error, this *does not* move Buffer.
     47   llvm::ErrorOr<llvm::Module *>
     48   getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,
     49                        LLVMContext &Context,
     50                        const DiagnosticHandlerFunction &DiagnosticHandler = nullptr);
     51 
     52   /// Read the header of the specified bitcode buffer and extract just the
     53   /// triple information. If successful, this returns a string. On error, this
     54   /// returns "".
     55   std::string
     56   getBitcodeTargetTriple(MemoryBufferRef Buffer, LLVMContext &Context,
     57                          DiagnosticHandlerFunction DiagnosticHandler = nullptr);
     58 
     59   /// Read the specified bitcode file, returning the module.
     60   llvm::ErrorOr<llvm::Module *>
     61   parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context,
     62                    const DiagnosticHandlerFunction &DiagnosticHandler = nullptr);
     63 } // End llvm_3_0 namespace
     64 
     65 #endif
     66