codemod 2010-2016 to 2010-present
[hiphop-php.git] / hphp / runtime / vm / jit / vasm-print.h
blob19505c30a120501a671593a85daa247242ef8c14
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present 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;
32 struct Vconst;
34 ///////////////////////////////////////////////////////////////////////////////
36 std::string show(Vreg r);
37 std::string show(Vptr p);
38 std::string show(Vconst c);
39 std::string show(const Vunit& unit);
40 std::string show(const Vunit& unit, const Vinstr& inst);
42 // print a dot-compatible digraph of the blocks (without contents)
43 void printCfg(const Vunit& unit, const jit::vector<Vlabel>& blocks);
44 void printCfg(std::ostream& out, const Vunit& unit,
45 const jit::vector<Vlabel>& blocks);
47 // Tracing level constants.
48 constexpr int kInitialVasmLevel = 1;
49 constexpr int kVasmImmsLevel = 2;
50 constexpr int kVasmSimplifyLevel = 2;
51 constexpr int kVasmFusionLevel = 2;
52 constexpr int kVasmCodeGenLevel = 2;
53 constexpr int kVasmAnnotateSFLevel = 2;
54 constexpr int kVasmRegAllocLevel = 3;
55 constexpr int kVasmCopyPropLevel = 4;
56 constexpr int kVasmARMFoldLevel = 4;
57 constexpr int kVasmJumpsLevel = 4;
58 constexpr int kVasmExitsLevel = 4;
59 constexpr int kVasmHoistFbccsLevel = 4;
60 constexpr int kVasmDCELevel = 4;
61 constexpr int kVasmLowerLevel = 4;
62 constexpr int kVasmUnreachableLevel = 6;
64 // Print the cfg digraph followed by a vasm code listing, if the trace level is
65 // above `level'.
66 void printUnit(int level,
67 const std::string& caption,
68 const Vunit& unit);
70 void printInstrs(std::ostream& out,
71 const Vunit& unit,
72 const jit::vector<Vinstr>& code);
74 // main, cold, frozen
75 extern const char* area_names[];
77 ///////////////////////////////////////////////////////////////////////////////
80 #endif