blob: 433d55d4218b93cc6a55042ae7ac2bef95d2a7d3 [file] [log] [blame]
Nicolas Geoffrayf635e632014-05-14 09:43:38 +01001/*
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
20#include "utils/allocation.h"
21
22namespace art {
23
24class DexCompilationUnit;
25class HGraph;
26
27/**
28 * If enabled, emits compilation information suitable for the c1visualizer tool
29 * and IRHydra.
30 * Currently only works if the compiler is single threaded.
31 */
32class HGraphVisualizer : public ValueObject {
33 public:
34 /**
35 * If output is not null, and the method name of the dex compilation
36 * unit contains `string_filter`, the compilation information will be
37 * emitted.
38 */
39 HGraphVisualizer(std::ostream* output,
40 HGraph* graph,
41 const char* string_filter,
42 const DexCompilationUnit& cu);
43
44 /**
45 * If this visualizer is enabled, emit the compilation information
46 * in `output_`.
47 */
48 void DumpGraph(const char* pass_name);
49
50 private:
51 std::ostream* const output_;
52 HGraph* const graph_;
53
54 // Is true when `output_` is not null, and the compiled method's name
55 // contains the string_filter given in the constructor.
56 bool is_enabled_;
57
58 DISALLOW_COPY_AND_ASSIGN(HGraphVisualizer);
59};
60
61} // namespace art
62
63#endif // ART_COMPILER_OPTIMIZING_GRAPH_VISUALIZER_H_