blob: 62a5a2c0e0908ade1190e43a4ba750af5981be17 [file] [log] [blame]
Nicolas Geoffray818f2102014-02-18 16:43:35 +00001/*
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_PRETTY_PRINTER_H_
18#define ART_COMPILER_OPTIMIZING_PRETTY_PRINTER_H_
19
20#include "nodes.h"
21
22namespace art {
23
24class HPrettyPrinter : public HGraphVisitor {
25 public:
26 explicit HPrettyPrinter(HGraph* graph) : HGraphVisitor(graph) { }
27
28 virtual void VisitInstruction(HInstruction* instruction) {
29 PrintString(" ");
30 PrintString(instruction->DebugName());
31 PrintNewLine();
32 }
33
34 virtual void VisitBasicBlock(HBasicBlock* block) {
35 PrintString("BasicBlock ");
36 PrintInt(block->block_id());
37 PrintNewLine();
38 HGraphVisitor::VisitBasicBlock(block);
39 }
40
41 virtual void PrintNewLine() = 0;
42 virtual void PrintInt(int value) = 0;
43 virtual void PrintString(const char* value) = 0;
44
45 private:
46 DISALLOW_COPY_AND_ASSIGN(HPrettyPrinter);
47};
48
49} // namespace art
50
51#endif // ART_COMPILER_OPTIMIZING_PRETTY_PRINTER_H_