mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-02 07:41:38 +00:00

This commit is the initial commit for the MIR serialization project. It creates a new library under CodeGen called 'MIR'. This new library adds a new machine function pass that prints out the LLVM IR using the MIR format. This pass is then added as a last pass when a 'stop-after' option is used in llc. The new library adds the initial functionality for parsing of MIR files as well. This commit also extends the llc tool so that it can recognize and parse MIR input files. Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames Differential Revision: http://reviews.llvm.org/D9616 llvm-svn: 237708
53 lines
1.8 KiB
C++
53 lines
1.8 KiB
C++
//===- MIRParser.h - MIR serialization format parser ----------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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_MIR_MIRPARSER_H
|
|
#define LLVM_CODEGEN_MIR_MIRPARSER_H
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/IR/Module.h"
|
|
#include "llvm/Support/MemoryBuffer.h"
|
|
#include <memory>
|
|
|
|
namespace llvm {
|
|
|
|
class SMDiagnostic;
|
|
|
|
/// This function is the main interface to the MIR serialization format parser.
|
|
///
|
|
/// It reads a YAML file that has an optional LLVM IR and returns an LLVM
|
|
/// module.
|
|
/// \param Filename - The name of the file to parse.
|
|
/// \param Error - Error result info.
|
|
/// \param Context - Context in which to allocate globals info.
|
|
std::unique_ptr<Module> parseMIRFile(StringRef Filename, SMDiagnostic &Error,
|
|
LLVMContext &Context);
|
|
|
|
/// This function is another interface to the MIR serialization format parser.
|
|
///
|
|
/// It parses the optional LLVM IR in the given buffer, and returns an LLVM
|
|
/// module.
|
|
/// \param Contents - The MemoryBuffer containing the machine level IR.
|
|
/// \param Error - Error result info.
|
|
/// \param Context - Context in which to allocate globals info.
|
|
std::unique_ptr<Module> parseMIR(std::unique_ptr<MemoryBuffer> Contents,
|
|
SMDiagnostic &Error, LLVMContext &Context);
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif
|