Store num args instead of offset in prologue and func entry SrcKeys
[hiphop-php.git] / hphp / runtime / vm / jit / reg-alloc.h
blob32354d94efe468556f1c9ea2ced46c6b4aea82bf
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 <vector>
21 #include "hphp/runtime/vm/jit/block.h"
22 #include "hphp/runtime/vm/jit/phys-reg.h"
23 #include "hphp/runtime/vm/jit/state-vector.h"
24 #include "hphp/runtime/vm/jit/translator-runtime.h"
26 namespace HPHP::jit {
28 ///////////////////////////////////////////////////////////////////////////////
30 struct Abi;
31 struct IRUnit;
32 struct Vinstr;
33 struct Vunit;
35 namespace irlower { struct IRLS; }
37 ///////////////////////////////////////////////////////////////////////////////
39 // Native stack layout:
40 // | enterTCHelper |
41 // +---------------+
42 // | return addr |
43 // | saved %rbp |
44 // +---------------+
45 // | | ...up to kMaxSpillSlots
46 // | spill slots | <-- spill[1]
47 // | | <-- spill[0]
48 // +---------------+
52 * Return the byte offset to a spill slot.
54 inline uint32_t slotOffset(uint32_t slot) {
55 return slot * sizeof(uint64_t);
59 * Return true if the offset of this spill slot is 16-byte aligned.
61 inline bool isSlotAligned(uint32_t slot) {
62 return slot % 2 == 0;
65 const size_t kMaxSpillSlots = 128;
68 * Return InvalidReg, or a specific register to force `tmp' to use.
70 PhysReg forceAlloc(const SSATmp& tmp);
73 * Assign virtual registers to all SSATmps used or defined in reachable blocks.
75 void assignRegs(const IRUnit& unit, Vunit& vunit, irlower::IRLS& state,
76 const BlockList& blocks);
79 * Return the set of physical registers implicitly accessed (used or defined).
81 void getEffects(const Abi& abi, const Vinstr& i,
82 RegSet& uses, RegSet& across, RegSet& defs);
84 ///////////////////////////////////////////////////////////////////////////////