1 //===-- llvm/Assembly/Parser.h - Parser for VM assembly files ---*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // These classes are implemented by the lib/AsmParser library. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_ASSEMBLY_PARSER_H 15 #define LLVM_ASSEMBLY_PARSER_H 16 17 #include <string> 18 19 namespace llvm { 20 21 class Module; 22 class MemoryBuffer; 23 class SMDiagnostic; 24 class LLVMContext; 25 26 /// This function is the main interface to the LLVM Assembly Parser. It parses 27 /// an ASCII file that (presumably) contains LLVM Assembly code. It returns a 28 /// Module (intermediate representation) with the corresponding features. Note 29 /// that this does not verify that the generated Module is valid, so you should 30 /// run the verifier after parsing the file to check that it is okay. 31 /// @brief Parse LLVM Assembly from a file 32 Module *ParseAssemblyFile( 33 const std::string &Filename, ///< The name of the file to parse 34 SMDiagnostic &Error, ///< Error result info. 35 LLVMContext &Context ///< Context in which to allocate globals info. 36 ); 37 38 /// The function is a secondary interface to the LLVM Assembly Parser. It parses 39 /// an ASCII string that (presumably) contains LLVM Assembly code. It returns a 40 /// Module (intermediate representation) with the corresponding features. Note 41 /// that this does not verify that the generated Module is valid, so you should 42 /// run the verifier after parsing the file to check that it is okay. 43 /// @brief Parse LLVM Assembly from a string 44 Module *ParseAssemblyString( 45 const char *AsmString, ///< The string containing assembly 46 Module *M, ///< A module to add the assembly too. 47 SMDiagnostic &Error, ///< Error result info. 48 LLVMContext &Context 49 ); 50 51 /// This function is the low-level interface to the LLVM Assembly Parser. 52 /// ParseAssemblyFile and ParseAssemblyString are wrappers around this function. 53 /// @brief Parse LLVM Assembly from a MemoryBuffer. This function *always* 54 /// takes ownership of the MemoryBuffer. 55 Module *ParseAssembly( 56 MemoryBuffer *F, ///< The MemoryBuffer containing assembly 57 Module *M, ///< A module to add the assembly too. 58 SMDiagnostic &Err, ///< Error result info. 59 LLVMContext &Context 60 ); 61 62 } // End llvm namespace 63 64 #endif 65