Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_OPTIMIZING_GRAPH_VISUALIZER_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_GRAPH_VISUALIZER_H_ |
| 19 | |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 20 | #include <ostream> |
| 21 | |
Ian Rogers | 0279ebb | 2014-10-08 17:27:48 -0700 | [diff] [blame] | 22 | #include "base/value_object.h" |
Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 23 | |
| 24 | namespace art { |
| 25 | |
Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 26 | class CodeGenerator; |
Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 27 | class DexCompilationUnit; |
| 28 | class HGraph; |
| 29 | |
| 30 | /** |
David Brazdil | ee690a3 | 2014-12-01 17:04:16 +0000 | [diff] [blame] | 31 | * This class outputs the HGraph in the C1visualizer format. |
| 32 | * Note: Currently only works if the compiler is single threaded. |
Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 33 | */ |
| 34 | class HGraphVisualizer : public ValueObject { |
| 35 | public: |
Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 36 | HGraphVisualizer(std::ostream* output, |
| 37 | HGraph* graph, |
Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 38 | const CodeGenerator& codegen, |
Nicolas Geoffray | e53798a | 2014-12-01 10:31:54 +0000 | [diff] [blame] | 39 | const char* method_name); |
Nicolas Geoffray | 0d3f578 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 40 | |
David Brazdil | ee690a3 | 2014-12-01 17:04:16 +0000 | [diff] [blame] | 41 | void DumpGraph(const char* pass_name, bool is_after_pass = true) const; |
Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 42 | |
| 43 | private: |
| 44 | std::ostream* const output_; |
| 45 | HGraph* const graph_; |
Nicolas Geoffray | a7062e0 | 2014-05-22 12:50:17 +0100 | [diff] [blame] | 46 | const CodeGenerator& codegen_; |
Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 47 | |
Nicolas Geoffray | f635e63 | 2014-05-14 09:43:38 +0100 | [diff] [blame] | 48 | DISALLOW_COPY_AND_ASSIGN(HGraphVisualizer); |
| 49 | }; |
| 50 | |
| 51 | } // namespace art |
| 52 | |
| 53 | #endif // ART_COMPILER_OPTIMIZING_GRAPH_VISUALIZER_H_ |