1 //===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ---*- C++ -*-===//
3 // This functionality is implemented by the lib/Bytecode/Reader library.
4 // This library is used to read VM bytecode files from an iostream.
6 // Note that performance of this library is _crucial_ for performance of the
7 // JIT type applications, so we have designed the bytecode format to support
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_BYTECODE_READER_H
13 #define LLVM_BYTECODE_READER_H
15 #include "llvm/ModuleProvider.h"
19 /// getBytecodeModuleProvider - lazy function-at-a-time loading from a file
21 AbstractModuleProvider*
22 getBytecodeModuleProvider(const std::string &Filename);
24 /// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a
27 AbstractModuleProvider*
28 getBytecodeBufferModuleProvider(const unsigned char *Buffer,
30 const std::string &ModuleID = "");
32 /// ParseBytecodeFile - Parse the given bytecode file
34 Module* ParseBytecodeFile(const std::string &Filename,
35 std::string *ErrorStr = 0);
37 /// ParseBytecodeBuffer - Parse a given bytecode buffer
39 Module* ParseBytecodeBuffer(const unsigned char *Buffer,
41 const std::string &ModuleID = "",
42 std::string *ErrorStr = 0);
44 /// ReadArchiveFile - Read bytecode files from the specfied .a file, returning
45 /// true on error, or false on success.
47 bool ReadArchiveFile(const std::string &Filename,
48 std::vector<Module*> &Objects,
49 std::string *ErrorStr = 0);