2014-01-12 11:10:32 +00:00
|
|
|
//===- IRPrintingPasses.h - Passes to print out IR constructs ---*- C++ -*-===//
|
2005-04-21 20:19:05 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:19:05 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2014-01-12 11:10:32 +00:00
|
|
|
/// \file
|
|
|
|
///
|
|
|
|
/// This file defines passes to print out IR in various granularities. The
|
|
|
|
/// PrintModulePass pass simply prints out the entire module when it is
|
|
|
|
/// executed. The PrintFunctionPass class is designed to be pipelined with
|
|
|
|
/// other FunctionPass's, and prints out the functions of the module as they
|
|
|
|
/// are processed.
|
|
|
|
///
|
2001-10-18 20:31:42 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-01-14 05:50:19 +00:00
|
|
|
#ifndef LLVM_IR_IR_PRINTING_PASSES_H
|
|
|
|
#define LLVM_IR_IR_PRINTING_PASSES_H
|
2001-10-18 20:31:42 +00:00
|
|
|
|
2014-01-12 12:15:39 +00:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2008-10-21 23:33:38 +00:00
|
|
|
#include <string>
|
2001-10-18 20:31:42 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
2014-01-12 12:15:39 +00:00
|
|
|
class BasicBlockPass;
|
|
|
|
class Function;
|
2014-01-12 10:56:57 +00:00
|
|
|
class FunctionPass;
|
2014-01-12 12:15:39 +00:00
|
|
|
class Module;
|
2014-01-12 10:56:57 +00:00
|
|
|
class ModulePass;
|
2014-01-12 12:15:39 +00:00
|
|
|
class PreservedAnalyses;
|
2014-01-12 10:56:57 +00:00
|
|
|
class raw_ostream;
|
|
|
|
|
2014-01-12 11:10:32 +00:00
|
|
|
/// \brief Create and return a pass that writes the module to the specified
|
|
|
|
/// \c raw_ostream.
|
2014-01-12 11:30:46 +00:00
|
|
|
ModulePass *createPrintModulePass(raw_ostream &OS,
|
2014-01-12 10:56:57 +00:00
|
|
|
const std::string &Banner = "");
|
|
|
|
|
2014-01-12 11:10:32 +00:00
|
|
|
/// \brief Create and return a pass that prints functions to the specified
|
|
|
|
/// \c raw_ostream as they are processed.
|
2014-01-12 11:30:46 +00:00
|
|
|
FunctionPass *createPrintFunctionPass(raw_ostream &OS,
|
|
|
|
const std::string &Banner = "");
|
2014-01-12 10:56:57 +00:00
|
|
|
|
2014-01-12 11:10:32 +00:00
|
|
|
/// \brief Create and return a pass that writes the BB to the specified
|
|
|
|
/// \c raw_ostream.
|
2014-01-12 11:30:46 +00:00
|
|
|
BasicBlockPass *createPrintBasicBlockPass(raw_ostream &OS,
|
2014-01-12 10:56:57 +00:00
|
|
|
const std::string &Banner = "");
|
|
|
|
|
2014-01-12 12:15:39 +00:00
|
|
|
/// \brief Pass for printing a Module as LLVM's text IR assembly.
|
|
|
|
///
|
|
|
|
/// Note: This pass is for use with the new pass manager. Use the create...Pass
|
|
|
|
/// functions above to create passes for use with the legacy pass manager.
|
|
|
|
class PrintModulePass {
|
|
|
|
raw_ostream &OS;
|
|
|
|
std::string Banner;
|
|
|
|
|
|
|
|
public:
|
|
|
|
PrintModulePass();
|
|
|
|
PrintModulePass(raw_ostream &OS, const std::string &Banner = "");
|
|
|
|
|
|
|
|
PreservedAnalyses run(Module *M);
|
|
|
|
|
|
|
|
static StringRef name() { return "PrintModulePass"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
/// \brief Pass for printing a Function as LLVM's text IR assembly.
|
|
|
|
///
|
|
|
|
/// Note: This pass is for use with the new pass manager. Use the create...Pass
|
|
|
|
/// functions above to create passes for use with the legacy pass manager.
|
|
|
|
class PrintFunctionPass {
|
|
|
|
raw_ostream &OS;
|
|
|
|
std::string Banner;
|
|
|
|
|
|
|
|
public:
|
|
|
|
PrintFunctionPass();
|
|
|
|
PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
|
|
|
|
|
|
|
|
PreservedAnalyses run(Function *F);
|
|
|
|
|
|
|
|
static StringRef name() { return "PrintFunctionPass"; }
|
|
|
|
};
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-10-18 20:31:42 +00:00
|
|
|
#endif
|