OLD | NEW |
1 //===-- llvm/IRReader/IRReader.h - Reader of IR ----------------*- C++ -*-===// | 1 //===-- llvm/IRReader/IRReader.h - Reader of IR ----------------*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This header defines IR readers that understand LLVM and PNaCl file formats. | 10 // This header defines IR readers that understand LLVM and PNaCl file formats. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #ifndef LLVM_IRREADER_IRREADER_H | 14 #ifndef LLVM_IRREADER_IRREADER_H |
15 #define LLVM_IRREADER_IRREADER_H | 15 #define LLVM_IRREADER_IRREADER_H |
16 | 16 |
17 namespace llvm { | 17 namespace llvm { |
18 | 18 |
19 class LLVM_Context; | 19 class LLVMContext; |
20 class MemoryBuffer; | 20 class MemoryBuffer; |
| 21 class Module; |
21 class SMDiagnostic; | 22 class SMDiagnostic; |
22 | 23 |
23 // \brief Define the expected format of the file. | 24 // \brief Define the expected format of the file. |
24 enum NaClFileFormat { | 25 enum NaClFileFormat { |
25 // LLVM IR source or bitcode file (as appropriate). | 26 // LLVM IR source or bitcode file (as appropriate). |
26 LLVMFormat, | 27 LLVMFormat, |
27 // PNaCl bitcode file. | 28 // PNaCl bitcode file. |
28 PNaClFormat | 29 PNaClFormat |
29 }; | 30 }; |
30 | 31 |
31 // \brief If the given MemoryBuffer holds a bitcode image, return a Module | 32 // \brief If the given MemoryBuffer holds a bitcode image, return a Module |
32 // for it. Otherwise, attempt to parse it as LLVM Assembly and return | 33 // for it. Otherwise, attempt to parse it as LLVM Assembly and return |
33 // a Module for it. This function *always* takes ownership of the given | 34 // a Module for it. This function *always* takes ownership of the given |
34 // MemoryBuffer. | 35 // MemoryBuffer. |
35 Module *NaClParseIR(MemoryBuffer *Buffer, | 36 Module *NaClParseIR(MemoryBuffer *Buffer, |
36 NaClFileFormat Format, | 37 NaClFileFormat Format, |
37 SMDiagnostic &Err, | 38 SMDiagnostic &Err, |
38 LLVMContext &Context); | 39 LLVMContext &Context); |
39 | 40 |
40 /// \brief If the given file holds a Bitcode image, read the file. | 41 /// \brief If the given file holds a Bitcode image, read the file. |
41 /// Otherwise, attempt to parse it as LLVM assembly and return a | 42 /// Otherwise, attempt to parse it as LLVM assembly and return a |
42 /// Module for it. | 43 /// Module for it. |
43 Module *NaClParseIRFile(const std::string &Filename, | 44 Module *NaClParseIRFile(const std::string &Filename, |
44 NaClFileFormat Format, | 45 NaClFileFormat Format, |
45 SMDiagnostic &Err, | 46 SMDiagnostic &Err, |
46 LLVMContext &Context); | 47 LLVMContext &Context); |
47 | 48 |
48 } // end llvm namespace | 49 } // end llvm namespace |
49 #endif | 50 #endif |
OLD | NEW |