src/share/vm/opto/idealGraphPrinter.hpp

Thu, 24 May 2018 19:26:50 +0800

author
aoqi
date
Thu, 24 May 2018 19:26:50 +0800
changeset 8862
fd13a567f179
parent 6876
710a3c8b516e
permissions
-rw-r--r--

#7046 C2 supports long branch
Contributed-by: fujie

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP
aoqi@0 26 #define SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP
aoqi@0 27
aoqi@0 28 #include "libadt/dict.hpp"
aoqi@0 29 #include "libadt/vectset.hpp"
aoqi@0 30 #include "utilities/growableArray.hpp"
aoqi@0 31 #include "utilities/ostream.hpp"
aoqi@0 32 #include "utilities/xmlstream.hpp"
aoqi@0 33
aoqi@0 34 #ifndef PRODUCT
aoqi@0 35
aoqi@0 36 class Compile;
aoqi@0 37 class PhaseIFG;
aoqi@0 38 class PhaseChaitin;
aoqi@0 39 class Matcher;
aoqi@0 40 class Node;
aoqi@0 41 class InlineTree;
aoqi@0 42 class ciMethod;
aoqi@0 43
aoqi@0 44 class IdealGraphPrinter : public CHeapObj<mtCompiler> {
aoqi@0 45 private:
aoqi@0 46
aoqi@0 47 static const char *INDENT;
aoqi@0 48 static const char *TOP_ELEMENT;
aoqi@0 49 static const char *GROUP_ELEMENT;
aoqi@0 50 static const char *GRAPH_ELEMENT;
aoqi@0 51 static const char *PROPERTIES_ELEMENT;
aoqi@0 52 static const char *EDGES_ELEMENT;
aoqi@0 53 static const char *PROPERTY_ELEMENT;
aoqi@0 54 static const char *EDGE_ELEMENT;
aoqi@0 55 static const char *NODE_ELEMENT;
aoqi@0 56 static const char *NODES_ELEMENT;
aoqi@0 57 static const char *CONTROL_FLOW_ELEMENT;
aoqi@0 58 static const char *REMOVE_EDGE_ELEMENT;
aoqi@0 59 static const char *REMOVE_NODE_ELEMENT;
aoqi@0 60 static const char *METHOD_NAME_PROPERTY;
aoqi@0 61 static const char *BLOCK_NAME_PROPERTY;
aoqi@0 62 static const char *BLOCK_DOMINATOR_PROPERTY;
aoqi@0 63 static const char *BLOCK_ELEMENT;
aoqi@0 64 static const char *SUCCESSORS_ELEMENT;
aoqi@0 65 static const char *SUCCESSOR_ELEMENT;
aoqi@0 66 static const char *METHOD_IS_PUBLIC_PROPERTY;
aoqi@0 67 static const char *METHOD_IS_STATIC_PROPERTY;
aoqi@0 68 static const char *TRUE_VALUE;
aoqi@0 69 static const char *NODE_NAME_PROPERTY;
aoqi@0 70 static const char *EDGE_NAME_PROPERTY;
aoqi@0 71 static const char *NODE_ID_PROPERTY;
aoqi@0 72 static const char *FROM_PROPERTY;
aoqi@0 73 static const char *TO_PROPERTY;
aoqi@0 74 static const char *PROPERTY_NAME_PROPERTY;
aoqi@0 75 static const char *GRAPH_NAME_PROPERTY;
aoqi@0 76 static const char *INDEX_PROPERTY;
aoqi@0 77 static const char *METHOD_ELEMENT;
aoqi@0 78 static const char *INLINE_ELEMENT;
aoqi@0 79 static const char *BYTECODES_ELEMENT;
aoqi@0 80 static const char *METHOD_BCI_PROPERTY;
aoqi@0 81 static const char *METHOD_SHORT_NAME_PROPERTY;
aoqi@0 82 static const char *ASSEMBLY_ELEMENT;
aoqi@0 83
aoqi@0 84 elapsedTimer _walk_time;
aoqi@0 85 elapsedTimer _output_time;
aoqi@0 86 elapsedTimer _build_blocks_time;
aoqi@0 87
aoqi@0 88 static int _file_count;
aoqi@0 89 networkStream *_stream;
aoqi@0 90 xmlStream *_xml;
aoqi@0 91 outputStream *_output;
aoqi@0 92 ciMethod *_current_method;
aoqi@0 93 int _depth;
aoqi@0 94 char buffer[128];
aoqi@0 95 bool _should_send_method;
aoqi@0 96 PhaseChaitin* _chaitin;
aoqi@0 97 bool _traverse_outs;
aoqi@0 98 Compile *C;
aoqi@0 99
aoqi@0 100 static void pre_node(Node* node, void *env);
aoqi@0 101 static void post_node(Node* node, void *env);
aoqi@0 102
aoqi@0 103 void print_indent();
aoqi@0 104 void print_method(ciMethod *method, int bci, InlineTree *tree);
aoqi@0 105 void print_inline_tree(InlineTree *tree);
aoqi@0 106 void visit_node(Node *n, bool edges, VectorSet* temp_set);
aoqi@0 107 void walk_nodes(Node *start, bool edges, VectorSet* temp_set);
aoqi@0 108 void begin_elem(const char *s);
aoqi@0 109 void end_elem();
aoqi@0 110 void begin_head(const char *s);
aoqi@0 111 void end_head();
aoqi@0 112 void print_attr(const char *name, const char *val);
aoqi@0 113 void print_attr(const char *name, intptr_t val);
aoqi@0 114 void print_prop(const char *name, const char *val);
aoqi@0 115 void print_prop(const char *name, int val);
aoqi@0 116 void tail(const char *name);
aoqi@0 117 void head(const char *name);
aoqi@0 118 void text(const char *s);
aoqi@0 119 intptr_t get_node_id(Node *n);
aoqi@0 120 IdealGraphPrinter();
aoqi@0 121 ~IdealGraphPrinter();
aoqi@0 122
aoqi@0 123 public:
aoqi@0 124
aoqi@0 125 static void clean_up();
aoqi@0 126 static IdealGraphPrinter *printer();
aoqi@0 127
aoqi@0 128 bool traverse_outs();
aoqi@0 129 void set_traverse_outs(bool b);
aoqi@0 130 outputStream *output();
aoqi@0 131 void print_inlining(Compile* compile);
aoqi@0 132 void begin_method(Compile* compile);
aoqi@0 133 void end_method();
aoqi@0 134 void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false);
aoqi@0 135 void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false);
aoqi@0 136 void print_xml(const char *name);
aoqi@0 137 };
aoqi@0 138
aoqi@0 139 #endif
aoqi@0 140
aoqi@0 141 #endif // SHARE_VM_OPTO_IDEALGRAPHPRINTER_HPP

mercurial