1 //===---- llvm/IRReader/IRReader.h - Reader for LLVM IR files ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines functions for reading LLVM IR. They support both
11 // Bitcode and Assembly, automatically detecting the input format.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_IRREADER_IRREADER_H
16 #define LLVM_IRREADER_IRREADER_H
18 #include "llvm/Support/MemoryBuffer.h"
27 /// If the given file holds a bitcode image, return a Module
28 /// for it which does lazy deserialization of function bodies. Otherwise,
29 /// attempt to parse it as LLVM Assembly and return a fully populated
30 /// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode
31 /// reader to optionally enable lazy metadata loading.
32 std::unique_ptr<Module>
33 getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
34 bool ShouldLazyLoadMetadata = false);
36 /// If the given MemoryBuffer holds a bitcode image, return a Module
37 /// for it. Otherwise, attempt to parse it as LLVM Assembly and return
39 std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
40 LLVMContext &Context);
42 /// If the given file holds a bitcode image, return a Module for it.
43 /// Otherwise, attempt to parse it as LLVM Assembly and return a Module
45 std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err,
46 LLVMContext &Context);