|
|
|||
File indexing completed on 2026-05-10 08:44:11
0001 //===---- llvm/IRReader/IRReader.h - Reader for LLVM IR files ---*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file defines functions for reading LLVM IR. They support both 0010 // Bitcode and Assembly, automatically detecting the input format. 0011 // 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef LLVM_IRREADER_IRREADER_H 0015 #define LLVM_IRREADER_IRREADER_H 0016 0017 #include "llvm/ADT/StringRef.h" 0018 #include "llvm/Bitcode/BitcodeReader.h" 0019 #include <memory> 0020 0021 namespace llvm { 0022 0023 class MemoryBuffer; 0024 class MemoryBufferRef; 0025 class Module; 0026 class SMDiagnostic; 0027 class LLVMContext; 0028 0029 /// If the given MemoryBuffer holds a bitcode image, return a Module 0030 /// for it which does lazy deserialization of function bodies. Otherwise, 0031 /// attempt to parse it as LLVM Assembly and return a fully populated 0032 /// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode 0033 /// reader to optionally enable lazy metadata loading. This takes ownership 0034 /// of \p Buffer. 0035 std::unique_ptr<Module> getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, 0036 SMDiagnostic &Err, LLVMContext &Context, 0037 bool ShouldLazyLoadMetadata = false); 0038 0039 /// If the given file holds a bitcode image, return a Module 0040 /// for it which does lazy deserialization of function bodies. Otherwise, 0041 /// attempt to parse it as LLVM Assembly and return a fully populated 0042 /// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode 0043 /// reader to optionally enable lazy metadata loading. 0044 std::unique_ptr<Module> 0045 getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context, 0046 bool ShouldLazyLoadMetadata = false); 0047 0048 /// If the given MemoryBuffer holds a bitcode image, return a Module 0049 /// for it. Otherwise, attempt to parse it as LLVM Assembly and return 0050 /// a Module for it. 0051 /// \param DataLayoutCallback Override datalayout in the llvm assembly. 0052 std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err, 0053 LLVMContext &Context, 0054 ParserCallbacks Callbacks = {}); 0055 0056 /// If the given file holds a bitcode image, return a Module for it. 0057 /// Otherwise, attempt to parse it as LLVM Assembly and return a Module 0058 /// for it. 0059 /// \param DataLayoutCallback Override datalayout in the llvm assembly. 0060 std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err, 0061 LLVMContext &Context, 0062 ParserCallbacks Callbacks = {}); 0063 } 0064 0065 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|