1 //===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This functionality is implemented by the lib/Bytecode/Reader library.
11 // This library is used to read VM bytecode files from an iostream.
13 // Note that performance of this library is _crucial_ for performance of the
14 // JIT type applications, so we have designed the bytecode format to support
17 //===----------------------------------------------------------------------===//
19 #ifndef LLVM_BYTECODE_READER_H
20 #define LLVM_BYTECODE_READER_H
22 #include "llvm/ModuleProvider.h"
26 /// getBytecodeModuleProvider - lazy function-at-a-time loading from a file
28 ModuleProvider *getBytecodeModuleProvider(const std::string &Filename);
30 /// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a
33 ModuleProvider *getBytecodeBufferModuleProvider(const unsigned char *Buffer,
35 const std::string &ModuleID="");
37 /// ParseBytecodeFile - Parse the given bytecode file
39 Module* ParseBytecodeFile(const std::string &Filename,
40 std::string *ErrorStr = 0);
42 /// ParseBytecodeBuffer - Parse a given bytecode buffer
44 Module* ParseBytecodeBuffer(const unsigned char *Buffer,
46 const std::string &ModuleID = "",
47 std::string *ErrorStr = 0);
49 /// ReadArchiveFile - Read bytecode files from the specfied .a file, returning
50 /// true on error, or false on success.
52 bool ReadArchiveFile(const std::string &Filename,
53 std::vector<Module*> &Objects,
54 std::string *ErrorStr = 0);