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 #include "hphp/runtime/vm/jit/phys-reg.h"
19 #include "hphp/runtime/vm/jit/abi.h"
21 #include "hphp/ppc64-asm/asm-ppc64.h"
22 #include "hphp/util/arch.h"
23 #include "hphp/util/asm-x64.h"
24 #include "hphp/vixl/a64/macro-assembler-a64.h"
26 namespace HPHP
{ namespace jit
{
28 ///////////////////////////////////////////////////////////////////////////////
30 int PhysReg::getNumGP() {
31 return abi().gp().size();
34 int PhysReg::getNumSIMD() {
35 return abi().simd().size();
38 std::string
show(PhysReg r
) {
41 return r
.type() == PhysReg::GP
? reg::regname(Reg64(r
)) :
42 r
.type() == PhysReg::SIMD
? reg::regname(RegXMM(r
)) :
43 /* r.type() == PhysReg::SF) ? */ reg::regname(RegSF(r
));
46 if (r
.isSF()) return "SF";
48 return folly::to
<std::string
>(
49 r
.isGP() ? (vixl::Register(r
).size() == vixl::kXRegSize
? 'x' : 'w')
50 : (vixl::FPRegister(r
).size() == vixl::kSRegSize
? 's' : 'd'),
51 ((vixl::CPURegister
)r
).code()
55 return r
.type() == PhysReg::GP
? ppc64_asm::reg::regname(Reg64(r
)) :
56 r
.type() == PhysReg::SIMD
? ppc64_asm::reg::regname(RegXMM(r
)) :
57 /* r.type() == PhysReg::SF) ? */ ppc64_asm::reg::regname(RegSF(r
));
62 ///////////////////////////////////////////////////////////////////////////////
64 std::string
show(RegSet regs
) {
65 std::ostringstream out
;
69 regs
.forEach([&](PhysReg r
) {
70 out
<< sep
<< show(r
);
78 ///////////////////////////////////////////////////////////////////////////////