blob: 7b2b9db6e91f40d1dba6b6605883d45e95ff0ec7 [file]
//===- ViewFunctionGraph.h - View/write graphviz graphs ---------*- C++ -*-===//
//
// Copyright 2019 The MLIR Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =============================================================================
//
// Defines interface to produce Graphviz outputs of MLIR Functions.
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_TRANSFORMS_VIEWFUNCTIONGRAPH_H_
#define MLIR_TRANSFORMS_VIEWFUNCTIONGRAPH_H_
#include "mlir/Support/LLVM.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/raw_ostream.h"
namespace mlir {
class Function;
class FunctionPass;
/// Displays the CFG in a window. This is for use from the debugger and
/// depends on Graphviz to generate the graph.
void viewGraph(const Function &function, const Twine &name,
bool shortNames = false, const Twine &title = "",
llvm::GraphProgram::Name program = llvm::GraphProgram::DOT);
llvm::raw_ostream &writeGraph(llvm::raw_ostream &os, const Function *function,
bool shortNames = false, const Twine &title = "");
/// Creates a pass to print CFG graphs.
FunctionPass *createPrintCFGGraphPass(llvm::raw_ostream &os = llvm::errs(),
bool shortNames = false,
const llvm::Twine &title = "");
} // end namespace mlir
#endif // MLIR_TRANSFORMS_VIEWFUNCTIONGRAPH_H_