2 +----------------------------------------------------------------------+
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_VM_PRINT_H_
18 #define incl_HPHP_VM_PRINT_H_
20 #include "hphp/runtime/vm/jit/reg-alloc.h"
21 #include "hphp/runtime/vm/jit/type-constraint.h"
22 #include "hphp/runtime/vm/jit/type.h"
24 #include "hphp/util/trace.h"
28 namespace HPHP
{ namespace jit
{
32 struct GuardConstraints
;
37 void printInstr(std::ostream
& ostream
, const IRInstruction
*,
38 const GuardConstraints
* guards
= nullptr);
39 void printDsts(std::ostream
& os
, const IRInstruction
* inst
);
40 void printSrcs(std::ostream
& os
, const IRInstruction
* inst
);
41 void printOpcode(std::ostream
& os
, const IRInstruction
* inst
,
42 const GuardConstraints
* guards
);
43 void printSrcs(std::ostream
& os
, const IRInstruction
* inst
);
44 void printDsts(std::ostream
& os
, const IRInstruction
* inst
);
45 void print(std::ostream
& ostream
, const IRInstruction
*,
46 const GuardConstraints
* guards
= nullptr);
47 void print(const IRInstruction
*);
50 void print(std::ostream
& ostream
, const SSATmp
*);
51 void print(const SSATmp
*);
54 void print(std::ostream
& os
, const Block
* block
,
56 const AsmInfo
* asmInfo
= nullptr,
57 const GuardConstraints
* guards
= nullptr,
58 BCMarker
* curMarker
= nullptr);
59 void print(const Block
* block
);
62 void print(std::ostream
& ostream
, const IRUnit
&,
63 const AsmInfo
* asmInfo
= nullptr,
64 const GuardConstraints
* guards
= nullptr);
65 void print(const IRUnit
& unit
);
68 * Some utilities related to dumping. Rather than file-by-file control, we
69 * control most IR logging via the hhir trace module.
71 static inline bool dumpIREnabled(int level
= 1) {
72 return HPHP::Trace::moduleEnabledRelease(HPHP::Trace::printir
, level
) ||
73 RuntimeOption::EvalDumpIR
>= level
;
76 constexpr int kCodeGenLevel
= 1;
77 constexpr int kIRLevel
= 2;
78 constexpr int kOptLevel
= 3;
79 constexpr int kTraceletLevel
= 4;
80 constexpr int kRegAllocLevel
= 4;
81 constexpr int kRelocationLevel
= 4;
82 constexpr int kExtraLevel
= 6;
83 constexpr int kExtraExtraLevel
= 7;
85 void printUnit(int level
, const IRUnit
&, const char* caption
,
86 AsmInfo
* ai
= nullptr, const GuardConstraints
* guards
= nullptr,
87 Annotations
* annot
= nullptr);
89 inline std::ostream
& operator<<(std::ostream
& os
, const Type
& t
) {
90 return os
<< t
.toString();
92 inline std::ostream
& operator<<(std::ostream
& os
, TypeConstraint tc
) {
93 return os
<< tc
.toString();
96 std::string
banner(const char* caption
);
98 void disasmRange(std::ostream
& os
, TCA begin
, TCA end
);
99 inline void disasmRange(std::ostream
& os
, TcaRange r
) {
100 return disasmRange(os
, r
.begin(), r
.end());