Switch-related cleanup
[hiphop-php.git] / hphp / runtime / vm / jit / vasm-print.h
blob25702173b135467743eb08988d8852d77f5d8b7a
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_JIT_VASM_PRINT_H_
18 #define incl_HPHP_JIT_VASM_PRINT_H_
20 #include "hphp/runtime/vm/jit/vasm.h"
21 #include "hphp/runtime/vm/jit/vasm-reg.h"
23 #include <vector>
24 #include <iostream>
25 #include <string>
27 namespace HPHP { namespace jit {
28 ///////////////////////////////////////////////////////////////////////////////
30 struct Vinstr;
31 struct Vunit;
33 ///////////////////////////////////////////////////////////////////////////////
35 std::string show(Vreg r);
36 std::string show(Vptr p);
37 std::string show(const Vunit& unit);
38 std::string show(const Vunit& unit, const Vinstr& inst);
40 // print a dot-compatible digraph of the blocks (without contents)
41 void printCfg(const Vunit& unit, const jit::vector<Vlabel>& blocks);
42 void printCfg(std::ostream& out, const Vunit& unit,
43 const jit::vector<Vlabel>& blocks);
45 // Tracing level constants.
46 constexpr int kInitialVasmLevel = 1;
47 constexpr int kVasmImmsLevel = 2;
48 constexpr int kVasmFusionLevel = 2;
49 constexpr int kVasmCodeGenLevel = 2;
50 constexpr int kVasmRegAllocLevel = 3;
51 constexpr int kVasmCopyPropLevel = 4;
52 constexpr int kVasmARMFoldLevel = 4;
53 constexpr int kVasmJumpsLevel = 4;
54 constexpr int kVasmExitsLevel = 4;
55 constexpr int kVasmDCELevel = 4;
56 constexpr int kVasmLowerLevel = 4;
57 constexpr int kVasmUnreachableLevel = 6;
59 // Print the cfg digraph followed by a vasm code listing, if the trace level is
60 // above `level'.
61 void printUnit(int level,
62 const std::string& caption,
63 const Vunit& unit);
65 void printInstrs(std::ostream& out,
66 const Vunit& unit,
67 const jit::vector<Vinstr>& code);
69 // main, cold, frozen
70 extern const char* area_names[];
72 ///////////////////////////////////////////////////////////////////////////////
75 #endif