1 //===- MIRParser.h - MIR serialization format parser ----------------------===//
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 MIR serialization library is currently a work in progress. It can't
11 // serialize machine functions at this time.
13 // This file declares the functions that parse the MIR serialization format
16 //===----------------------------------------------------------------------===//
18 #ifndef LLVM_CODEGEN_MIR_MIRPARSER_H
19 #define LLVM_CODEGEN_MIR_MIRPARSER_H
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/IR/Module.h"
23 #include "llvm/Support/MemoryBuffer.h"
30 /// This function is the main interface to the MIR serialization format parser.
32 /// It reads a YAML file that has an optional LLVM IR and returns an LLVM
34 /// \param Filename - The name of the file to parse.
35 /// \param Error - Error result info.
36 /// \param Context - Context in which to allocate globals info.
37 std::unique_ptr<Module> parseMIRFile(StringRef Filename, SMDiagnostic &Error,
38 LLVMContext &Context);
40 /// This function is another interface to the MIR serialization format parser.
42 /// It parses the optional LLVM IR in the given buffer, and returns an LLVM
44 /// \param Contents - The MemoryBuffer containing the machine level IR.
45 /// \param Error - Error result info.
46 /// \param Context - Context in which to allocate globals info.
47 std::unique_ptr<Module> parseMIR(std::unique_ptr<MemoryBuffer> Contents,
48 SMDiagnostic &Error, LLVMContext &Context);
50 } // end namespace llvm