summaryrefslogtreecommitdiff
path: root/clang-r353983/include/llvm/CodeGen/MIRParser
diff options
context:
space:
mode:
authorRalf Luther <luther.ralf@gmail.com>2019-03-27 20:23:17 +0000
committerGerrit Code Review <gerrit2@aicp-server-3>2019-03-27 20:23:17 +0000
commit1ce3a9d272e564b22a1333a1e36a3d3ab7cfab01 (patch)
tree391382eadd4fec5bb480f2e8934fa352770221d1 /clang-r353983/include/llvm/CodeGen/MIRParser
parentd1d48b140bafaa8a50107292f5fce95562575765 (diff)
parent4f56932d3416ac03f646bc1a611b3135fec2fe08 (diff)
Merge "Update prebuilt Clang to r353983." into p9.0HEADp9.0-backupp9.0
Diffstat (limited to 'clang-r353983/include/llvm/CodeGen/MIRParser')
-rw-r--r--clang-r353983/include/llvm/CodeGen/MIRParser/MIRParser.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/clang-r353983/include/llvm/CodeGen/MIRParser/MIRParser.h b/clang-r353983/include/llvm/CodeGen/MIRParser/MIRParser.h
new file mode 100644
index 00000000..6a04e48e
--- /dev/null
+++ b/clang-r353983/include/llvm/CodeGen/MIRParser/MIRParser.h
@@ -0,0 +1,80 @@
+//===- MIRParser.h - MIR serialization format parser ------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This MIR serialization library is currently a work in progress. It can't
+// serialize machine functions at this time.
+//
+// This file declares the functions that parse the MIR serialization format
+// files.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_MIRPARSER_MIRPARSER_H
+#define LLVM_CODEGEN_MIRPARSER_MIRPARSER_H
+
+#include "llvm/IR/Module.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include <memory>
+
+namespace llvm {
+
+class StringRef;
+class MIRParserImpl;
+class MachineModuleInfo;
+class SMDiagnostic;
+
+/// This class initializes machine functions by applying the state loaded from
+/// a MIR file.
+class MIRParser {
+ std::unique_ptr<MIRParserImpl> Impl;
+
+public:
+ MIRParser(std::unique_ptr<MIRParserImpl> Impl);
+ MIRParser(const MIRParser &) = delete;
+ ~MIRParser();
+
+ /// Parses the optional LLVM IR module in the MIR file.
+ ///
+ /// A new, empty module is created if the LLVM IR isn't present.
+ /// \returns nullptr if a parsing error occurred.
+ std::unique_ptr<Module> parseIRModule();
+
+ /// Parses MachineFunctions in the MIR file and add them to the given
+ /// MachineModuleInfo \p MMI.
+ ///
+ /// \returns true if an error occurred.
+ bool parseMachineFunctions(Module &M, MachineModuleInfo &MMI);
+};
+
+/// This function is the main interface to the MIR serialization format parser.
+///
+/// It reads in a MIR file and returns a MIR parser that can parse the embedded
+/// LLVM IR module and initialize the machine functions by parsing the machine
+/// function's state.
+///
+/// \param Filename - The name of the file to parse.
+/// \param Error - Error result info.
+/// \param Context - Context which will be used for the parsed LLVM IR module.
+std::unique_ptr<MIRParser> createMIRParserFromFile(StringRef Filename,
+ SMDiagnostic &Error,
+ LLVMContext &Context);
+
+/// This function is another interface to the MIR serialization format parser.
+///
+/// It returns a MIR parser that works with the given memory buffer and that can
+/// parse the embedded LLVM IR module and initialize the machine functions by
+/// parsing the machine function's state.
+///
+/// \param Contents - The MemoryBuffer containing the machine level IR.
+/// \param Context - Context which will be used for the parsed LLVM IR module.
+std::unique_ptr<MIRParser>
+createMIRParser(std::unique_ptr<MemoryBuffer> Contents, LLVMContext &Context);
+
+} // end namespace llvm
+
+#endif // LLVM_CODEGEN_MIRPARSER_MIRPARSER_H