hotspot/src/share/vm/opto/idealGraphPrinter.hpp
author iveresov
Thu, 22 Jan 2015 11:25:23 -0800
changeset 28723 0a36120cb225
parent 27147 ed83dc5777e6
child 30591 b32fcc177417
permissions -rw-r--r--
8071302: assert(!_reg_node[reg_lo] || edge_from_to(_reg_node[reg_lo], def)) failed: after block local Summary: Add merge nodes to node to block mapping Reviewed-by: kvn, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
17376
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 17031
diff changeset
     2
 * Copyright (c) 2007, 2013, 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: 768
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 768
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: 768
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
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP
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 "libadt/dict.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "libadt/vectset.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "utilities/growableArray.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "utilities/ostream.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "utilities/xmlstream.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class Compile;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class PhaseIFG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class PhaseChaitin;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class Matcher;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class Node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class InlineTree;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
class ciMethod;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
17376
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 17031
diff changeset
    44
class IdealGraphPrinter : public CHeapObj<mtCompiler> {
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 17031
diff changeset
    45
 private:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  static const char *INDENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  static const char *TOP_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  static const char *GROUP_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  static const char *GRAPH_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  static const char *PROPERTIES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  static const char *EDGES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  static const char *PROPERTY_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  static const char *EDGE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  static const char *NODE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  static const char *NODES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  static const char *CONTROL_FLOW_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  static const char *REMOVE_EDGE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  static const char *REMOVE_NODE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  static const char *METHOD_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  static const char *BLOCK_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  static const char *BLOCK_DOMINATOR_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  static const char *BLOCK_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  static const char *SUCCESSORS_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static const char *SUCCESSOR_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  static const char *METHOD_IS_PUBLIC_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  static const char *METHOD_IS_STATIC_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  static const char *TRUE_VALUE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  static const char *NODE_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  static const char *EDGE_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  static const char *NODE_ID_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  static const char *FROM_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  static const char *TO_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  static const char *PROPERTY_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  static const char *GRAPH_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  static const char *INDEX_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  static const char *METHOD_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  static const char *INLINE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  static const char *BYTECODES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  static const char *METHOD_BCI_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  static const char *METHOD_SHORT_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  static const char *ASSEMBLY_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    84
  elapsedTimer _walk_time;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    85
  elapsedTimer _output_time;
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    86
  elapsedTimer _build_blocks_time;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  static int _file_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  networkStream *_stream;
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    90
  xmlStream *_xml;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  outputStream *_output;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  ciMethod *_current_method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  int _depth;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  char buffer[128];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  bool _should_send_method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  PhaseChaitin* _chaitin;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  bool _traverse_outs;
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    98
  Compile *C;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  static void pre_node(Node* node, void *env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  static void post_node(Node* node, void *env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  void print_indent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  void print_method(ciMethod *method, int bci, InlineTree *tree);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  void print_inline_tree(InlineTree *tree);
10514
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 8870
diff changeset
   106
  void visit_node(Node *n, bool edges, VectorSet* temp_set);
e229a19078cf 7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents: 8870
diff changeset
   107
  void walk_nodes(Node *start, bool edges, VectorSet* temp_set);
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   108
  void begin_elem(const char *s);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   109
  void end_elem();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   110
  void begin_head(const char *s);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   111
  void end_head();
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   112
  void print_attr(const char *name, const char *val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   113
  void print_attr(const char *name, intptr_t val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   114
  void print_prop(const char *name, const char *val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   115
  void print_prop(const char *name, int val);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   116
  void tail(const char *name);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   117
  void head(const char *name);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   118
  void text(const char *s);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   119
  intptr_t get_node_id(Node *n);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  IdealGraphPrinter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  ~IdealGraphPrinter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
17376
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 17031
diff changeset
   123
 public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  static void clean_up();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  static IdealGraphPrinter *printer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  bool traverse_outs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  void set_traverse_outs(bool b);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  outputStream *output();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  void print_inlining(Compile* compile);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  void begin_method(Compile* compile);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  void end_method();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  void print_xml(const char *name);
27147
ed83dc5777e6 8060215: per-method PrintIdealGraphLevel
zmajo
parents: 17376
diff changeset
   137
  static bool should_print(ciMethod* method, int level = 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   141
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   142
#endif // SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP