Add sub-controls for Hack array compat runtime checks
[hiphop-php.git] / hphp / runtime / vm / jit / irlower.h
blob7cd2adc0a3970a576e0e86e3ed3cdcb70c341e6c
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_IRLOWER_H_
18 #define incl_HPHP_JIT_IRLOWER_H_
20 #include "hphp/runtime/vm/jit/code-cache.h"
21 #include "hphp/runtime/vm/jit/state-vector.h"
22 #include "hphp/runtime/vm/jit/types.h"
23 #include "hphp/runtime/vm/jit/vasm-emit.h"
24 #include "hphp/runtime/vm/jit/vasm-reg.h"
25 #include "hphp/runtime/vm/jit/vasm-unit.h"
26 #include "hphp/runtime/vm/jit/vasm.h"
28 namespace HPHP { namespace jit {
30 struct IRUnit;
31 struct Vout;
33 ///////////////////////////////////////////////////////////////////////////////
35 namespace irlower {
37 ///////////////////////////////////////////////////////////////////////////////
39 enum class SyncOptions {
40 None,
41 Sync,
42 SyncAdjustOne,
46 * State updated and tracked across vasm generation for individual instructions
47 * and blocks.
49 struct IRLS {
50 explicit IRLS(const IRUnit& unit)
51 : unit(unit)
52 , labels(unit, Vlabel())
53 , locs(unit, Vloc{})
57 * The unit being lowered to vasm.
59 const IRUnit& unit;
62 * The vasm output streams.
64 * These may be updated during codegen of an instruction to point to new
65 * Vblocks.
67 Vout* vmain{nullptr};
68 Vout* vcold{nullptr};
71 * Vasm block labels, one for each HHIR block.
73 StateVector<Block,Vlabel> labels;
76 * Vlocs for each SSATmp used or defined in a reachable block.
78 StateVector<SSATmp,Vloc> locs;
82 * Estimate the cost of unit.
84 Vcost computeIRUnitCost(const IRUnit& unit);
87 * Lower the given HHIR unit to a Vunit, then optimize, regalloc, and return
88 * the Vunit. Returns nullptr on failure.
90 std::unique_ptr<Vunit> lowerUnit(const IRUnit&, CodeKind = CodeKind::Trace,
91 bool regAlloc = true) noexcept;
93 ///////////////////////////////////////////////////////////////////////////////
95 }}}
97 #endif