src/hotspot/share/c1/c1_CFGPrinter.hpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 53244 9807daeb47c4
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
     2
 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    25
#ifndef SHARE_C1_C1_CFGPRINTER_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    26
#define SHARE_C1_C1_CFGPRINTER_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "c1/c1_Compilation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "c1/c1_Instruction.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// This is a utility class used for recording the results of a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// compilation for later analysis.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class CFGPrinterOutput;
36302
23a79c43ba92 8067014: LinearScan::is_sorted significantly slows down fastdebug builds' performance
vlivanov
parents: 7397
diff changeset
    37
class Interval;
23a79c43ba92 8067014: LinearScan::is_sorted significantly slows down fastdebug builds' performance
vlivanov
parents: 7397
diff changeset
    38
23a79c43ba92 8067014: LinearScan::is_sorted significantly slows down fastdebug builds' performance
vlivanov
parents: 7397
diff changeset
    39
typedef GrowableArray<Interval*> IntervalList;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class CFGPrinter : public AllStatic {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  static void print_compilation(Compilation* compilation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  static void print_cfg(BlockList* blocks, const char* name, bool do_print_HIR, bool do_print_LIR);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  static void print_cfg(IR* blocks, const char* name, bool do_print_HIR, bool do_print_LIR);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  static void print_intervals(IntervalList* intervals, const char* name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
46526
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    49
class CFGPrinterOutput : public CHeapObj<mtCompiler> {
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    50
 private:
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    51
  outputStream* _output;
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    52
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    53
  Compilation*  _compilation;
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    54
  bool _do_print_HIR;
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    55
  bool _do_print_LIR;
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    56
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    57
  class PrintBlockClosure: public BlockClosure {
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    58
    void block_do(BlockBegin* block) { if (block != NULL) Compilation::current()->cfg_printer_output()->print_block(block); }
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    59
  };
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    60
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    61
  outputStream* output() { assert(_output != NULL, ""); return _output; }
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    62
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    63
  void inc_indent();
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    64
  void dec_indent();
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    65
  void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    66
  void print_begin(const char* tag);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    67
  void print_end(const char* tag);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    68
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    69
  char* method_name(ciMethod* method, bool short_name = false);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    70
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    71
 public:
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    72
  CFGPrinterOutput(Compilation* compilation);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    73
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    74
  void set_print_flags(bool do_print_HIR, bool do_print_LIR) { _do_print_HIR = do_print_HIR; _do_print_LIR = do_print_LIR; }
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    75
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    76
  void print_compilation();
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    77
  void print_intervals(IntervalList* intervals, const char* name);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    78
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    79
  void print_state(BlockBegin* block);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    80
  void print_operand(Value instr);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    81
  void print_HIR(Value instr);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    82
  void print_HIR(BlockBegin* block);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    83
  void print_LIR(BlockBegin* block);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    84
  void print_block(BlockBegin* block);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    85
  void print_cfg(BlockList* blocks, const char* name);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    86
  void print_cfg(IR* blocks, const char* name);
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    87
};
519f1fbec7af 8181644: C1 crashes with -XX:+PrintCFGToFile
thartmann
parents: 36302
diff changeset
    88
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    90
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    91
#endif // SHARE_C1_C1_CFGPRINTER_HPP