LLVM API Documentation
00001 //===---- llvm/IRReader/IRReader.h - Reader for LLVM IR files ---*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines functions for reading LLVM IR. They support both 00011 // Bitcode and Assembly, automatically detecting the input format. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_IRREADER_IRREADER_H 00016 #define LLVM_IRREADER_IRREADER_H 00017 00018 #include "llvm/Support/MemoryBuffer.h" 00019 #include <string> 00020 00021 namespace llvm { 00022 00023 class Module; 00024 class SMDiagnostic; 00025 class LLVMContext; 00026 00027 /// If the given file holds a bitcode image, return a Module 00028 /// for it which does lazy deserialization of function bodies. Otherwise, 00029 /// attempt to parse it as LLVM Assembly and return a fully populated 00030 /// Module. 00031 std::unique_ptr<Module> getLazyIRFileModule(StringRef Filename, 00032 SMDiagnostic &Err, 00033 LLVMContext &Context); 00034 00035 /// If the given MemoryBuffer holds a bitcode image, return a Module 00036 /// for it. Otherwise, attempt to parse it as LLVM Assembly and return 00037 /// a Module for it. 00038 std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err, 00039 LLVMContext &Context); 00040 00041 /// If the given file holds a bitcode image, return a Module for it. 00042 /// Otherwise, attempt to parse it as LLVM Assembly and return a Module 00043 /// for it. 00044 std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err, 00045 LLVMContext &Context); 00046 } 00047 00048 #endif