hotspot/src/share/vm/opto/idealGraphPrinter.hpp
author kvn
Wed, 20 Feb 2008 16:19:43 -0800
changeset 197 264e201bc1d5
parent 1 489c9b5090e2
child 768 d0bebc7eefc2
permissions -rw-r--r--
6614330: Node::dump(n) does not print full graph for specified depth. Summary: A node is not processed in dump_nodes() if it was visited during processing previous inputs. Reviewed-by: rasbold
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
class Compile;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
class PhaseIFG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
class PhaseChaitin;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
class Matcher;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
class Node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
class InlineTree;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class ciMethod;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class IdealGraphPrinter
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  enum State
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    Invalid,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    Valid,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    New
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  static const char *INDENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  static const char *TOP_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  static const char *GROUP_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  static const char *GRAPH_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  static const char *PROPERTIES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  static const char *EDGES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  static const char *PROPERTY_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  static const char *EDGE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  static const char *NODE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  static const char *NODES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  static const char *CONTROL_FLOW_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  static const char *REMOVE_EDGE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  static const char *REMOVE_NODE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  static const char *METHOD_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  static const char *BLOCK_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  static const char *BLOCK_DOMINATOR_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  static const char *BLOCK_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  static const char *SUCCESSORS_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  static const char *SUCCESSOR_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  static const char *METHOD_IS_PUBLIC_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  static const char *METHOD_IS_STATIC_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  static const char *TRUE_VALUE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  static const char *NODE_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  static const char *EDGE_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  static const char *NODE_ID_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  static const char *FROM_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  static const char *TO_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  static const char *PROPERTY_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  static const char *GRAPH_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  static const char *INDEX_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  static const char *METHOD_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  static const char *INLINE_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  static const char *BYTECODES_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  static const char *METHOD_BCI_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  static const char *METHOD_SHORT_NAME_PROPERTY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  static const char *ASSEMBLY_ELEMENT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  class Property {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    const char *_name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    const char *_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    Property();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    Property(const Property* p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    ~Property();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    Property(const char *name, const char *value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    Property(const char *name, int value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    bool equals(Property* p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    void print(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    void print_as_attribute(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    bool is_null();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    void clean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    const char *name();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    static const char* dup(const char *str) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
      char * copy = new char[strlen(str)+1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      strcpy(copy, str);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
      return copy;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  class Properties {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    GrowableArray<Property *> *list;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    Properties();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    ~Properties();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    void add(Property *p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    void remove(const char *name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    bool equals(Properties* p);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    void print(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    void print_as_attributes(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    void clean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  class Description {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    State _state;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    Description();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    State state();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    void set_state(State s);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    void print(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    virtual void print_changed(IdealGraphPrinter *printer) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    virtual void print_removed(IdealGraphPrinter *printer) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  class NodeDescription : public Description{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    static int count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    GrowableArray<NodeDescription *> _succs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    int _block_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    uintptr_t _id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    Properties _properties;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    Node* _node;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    NodeDescription(Node* node);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    ~NodeDescription();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    Node* node();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    // void set_node(Node* node);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    GrowableArray<NodeDescription *>* succs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    void init_succs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    void clear_succs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    void add_succ(NodeDescription *desc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
    int block_index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    void set_block_index(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    Properties* properties();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    virtual void print_changed(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    virtual void print_removed(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    bool equals(NodeDescription *desc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    uint id();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  class Block {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    NodeDescription *_start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    NodeDescription *_proj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    GrowableArray<int> _succs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    GrowableArray<NodeDescription *> _nodes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    GrowableArray<int> _dominates;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    GrowableArray<int> _children;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    int _semi;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    int _parent;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    GrowableArray<int> _pred;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    GrowableArray<int> _bucket;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    int _index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    int _dominator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    int _ancestor;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    int _label;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    Block();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    Block(int index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    void add_node(NodeDescription *n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    GrowableArray<NodeDescription *>* nodes();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    GrowableArray<int>* children();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    void add_child(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    void add_succ(int index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    GrowableArray<int>* succs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
    GrowableArray<int>* dominates();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    void add_dominates(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    NodeDescription *start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    NodeDescription *proj();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    void set_start(NodeDescription *n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
    void set_proj(NodeDescription *n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
    int label();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    void set_label(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    int ancestor();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    void set_ancestor(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    int index();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    int dominator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    void set_dominator(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    int parent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    void set_parent(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    int semi();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    GrowableArray<int>* bucket();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    void add_to_bucket(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    void clear_bucket();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    GrowableArray<int>* pred();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    void set_semi(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    void add_pred(int i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  class EdgeDescription : public Description {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
    int _from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    int _to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    int _index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    EdgeDescription(int from, int to, int index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    ~EdgeDescription();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
    virtual void print_changed(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
    virtual void print_removed(IdealGraphPrinter *printer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
    bool equals(EdgeDescription *desc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    int from();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    int to();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  static int _file_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  networkStream *_stream;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  outputStream *_output;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  ciMethod *_current_method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  GrowableArray<NodeDescription *> _nodes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  GrowableArray<EdgeDescription *> _edges;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  int _depth;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  Arena *_arena;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  char buffer[128];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  bool _should_send_method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  PhaseChaitin* _chaitin;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  bool _clear_nodes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  Matcher* _matcher;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  bool _traverse_outs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  void start_element_helper(const char *name, Properties *properties, bool endElement, bool print_indent = false, bool print_return = true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  NodeDescription *create_node_description(Node* node);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  static void pre_node(Node* node, void *env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  static void post_node(Node* node, void *env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  void schedule_latest(int **common_dominator, GrowableArray<Block>* blocks);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  void build_common_dominator(int **common_dominator, int index, GrowableArray<Block>* blocks);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  void compress(int index, GrowableArray<Block>* blocks);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  int eval(int index, GrowableArray<Block>* blocks);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  void link(int index1, int index2, GrowableArray<Block>* blocks);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  void build_dominators(GrowableArray<Block>* blocks);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  void build_blocks(Node *node);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  void walk(Node *n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  void start_element(const char *name, Properties *properties = NULL, bool print_indent = false, bool print_return = true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  void simple_element(const char *name, Properties *properties = NULL, bool print_indent = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  void end_element(const char *name, bool print_indent = false, bool print_return = true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  void print_edge(int from, int to, int index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  void print_indent();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  void print_method(ciMethod *method, int bci, InlineTree *tree);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  void print_inline_tree(InlineTree *tree);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  void clear_nodes();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  IdealGraphPrinter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  ~IdealGraphPrinter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  static void clean_up();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  static IdealGraphPrinter *printer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  bool traverse_outs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  void set_traverse_outs(bool b);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  void print_ifg(PhaseIFG* ifg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  outputStream *output();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  void print_inlining(Compile* compile);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  void begin_method(Compile* compile);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  void end_method();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  void print_xml(const char *name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
#endif