Store num args instead of offset in prologue and func entry SrcKeys
[hiphop-php.git] / hphp / runtime / vm / jit / irlower.h
blob9ddf1fd5d4c78fb419e3f78487bbe907b1980c86
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 #pragma once
19 #include "hphp/runtime/vm/jit/code-cache.h"
20 #include "hphp/runtime/vm/jit/state-vector.h"
21 #include "hphp/runtime/vm/jit/types.h"
22 #include "hphp/runtime/vm/jit/vasm-emit.h"
23 #include "hphp/runtime/vm/jit/vasm-reg.h"
24 #include "hphp/runtime/vm/jit/vasm-unit.h"
25 #include "hphp/runtime/vm/jit/vasm.h"
27 namespace HPHP::jit {
29 struct IRUnit;
30 struct Vout;
32 ///////////////////////////////////////////////////////////////////////////////
34 namespace irlower {
36 ///////////////////////////////////////////////////////////////////////////////
38 enum class SyncOptions {
39 None,
40 Sync,
44 * State updated and tracked across vasm generation for individual instructions
45 * and blocks.
47 struct IRLS {
48 explicit IRLS(const IRUnit& unit)
49 : unit(unit)
50 , labels(unit, Vlabel())
51 , locs(unit, Vloc{})
55 * The unit being lowered to vasm.
57 const IRUnit& unit;
60 * The vasm output streams.
62 * These may be updated during codegen of an instruction to point to new
63 * Vblocks.
65 Vout* vmain{nullptr};
66 Vout* vcold{nullptr};
69 * Vasm block labels, one for each HHIR block.
71 StateVector<Block,Vlabel> labels;
74 * Vlocs for each SSATmp used or defined in a reachable block.
76 StateVector<SSATmp,Vloc> locs;
80 * Estimate the cost of unit.
82 Vcost computeIRUnitCost(const IRUnit& unit);
85 * Optimize a vunit.
87 void optimize(Vunit& unit, CodeKind kind, bool regAlloc = true);
90 * Lower the given HHIR unit to a Vunit, then optimize, regalloc, and return
91 * the Vunit. Returns nullptr on failure.
93 std::unique_ptr<Vunit> lowerUnit(const IRUnit&,
94 CodeKind kind = CodeKind::Trace,
95 bool regAlloc = true) noexcept;
97 ///////////////////////////////////////////////////////////////////////////////