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"
28 /// getBytecodeModuleProvider - lazy function-at-a-time loading from a file
30 ModuleProvider *getBytecodeModuleProvider(const std::string &Filename);
32 /// getBytecodeBufferModuleProvider - lazy function-at-a-time loading from a
35 ModuleProvider *getBytecodeBufferModuleProvider(const unsigned char *Buffer,
37 const std::string &ModuleID="");
39 /// ParseBytecodeFile - Parse the given bytecode file
41 Module* ParseBytecodeFile(const std::string &Filename,
42 std::string *ErrorStr = 0);
44 /// ParseBytecodeBuffer - Parse a given bytecode buffer
46 Module* ParseBytecodeBuffer(const unsigned char *Buffer,
48 const std::string &ModuleID = "",
49 std::string *ErrorStr = 0);
51 /// ReadArchiveFile - Read bytecode files from the specfied .a file, returning
52 /// true on error, or false on success.
54 bool ReadArchiveFile(const std::string &Filename,
55 std::vector<Module*> &Objects,
56 std::string *ErrorStr = 0);
58 } // End llvm namespace