Path: blob/master/src/hotspot/share/c1/c1_CFGPrinter.hpp
40930 views
/*1* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_C1_C1_CFGPRINTER_HPP25#define SHARE_C1_C1_CFGPRINTER_HPP2627#include "c1/c1_Compilation.hpp"28#include "c1/c1_Instruction.hpp"2930#ifndef PRODUCT3132// This is a utility class used for recording the results of a33// compilation for later analysis.3435class CFGPrinterOutput;36class Interval;3738typedef GrowableArray<Interval*> IntervalList;3940class CFGPrinter : public AllStatic {41public:42static void print_compilation(Compilation* compilation);43static void print_cfg(BlockList* blocks, const char* name, bool do_print_HIR, bool do_print_LIR);44static void print_cfg(IR* blocks, const char* name, bool do_print_HIR, bool do_print_LIR);45static void print_intervals(IntervalList* intervals, const char* name);46};4748class CFGPrinterOutput : public CHeapObj<mtCompiler> {49private:50outputStream* _output;5152Compilation* _compilation;53bool _do_print_HIR;54bool _do_print_LIR;5556class PrintBlockClosure: public BlockClosure {57void block_do(BlockBegin* block) { if (block != NULL) Compilation::current()->cfg_printer_output()->print_block(block); }58};5960outputStream* output() { assert(_output != NULL, ""); return _output; }6162void inc_indent();63void dec_indent();64void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);65void print_begin(const char* tag);66void print_end(const char* tag);6768char* method_name(ciMethod* method, bool short_name = false);6970public:71CFGPrinterOutput(Compilation* compilation);7273void set_print_flags(bool do_print_HIR, bool do_print_LIR) { _do_print_HIR = do_print_HIR; _do_print_LIR = do_print_LIR; }7475void print_compilation();76void print_intervals(IntervalList* intervals, const char* name);7778void print_state(BlockBegin* block);79void print_operand(Value instr);80void print_HIR(Value instr);81void print_HIR(BlockBegin* block);82void print_LIR(BlockBegin* block);83void print_block(BlockBegin* block);84void print_cfg(BlockList* blocks, const char* name);85void print_cfg(IR* blocks, const char* name);86};8788#endif8990#endif // SHARE_C1_C1_CFGPRINTER_HPP919293