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