Debian Codegraph @

js/src/jit/arm/LIR-arm.h

raw
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef jit_arm_LIR_arm_h
8 #define jit_arm_LIR_arm_h
9
10 namespace js {
11 namespace jit {
12
13 class LUnbox : public LInstructionHelper<1, 2, 0> {
14 public:
15 LIR_HEADER(Unbox);
16
17 LUnbox() : LInstructionHelper(classOpcode) {}
18
19 MUnbox* mir() const { return mir_->toUnbox(); }
20 const LAllocation* payload() { return getOperand(0); }
21 const LAllocation* type() { return getOperand(1); }
22 const char* extraName() const { return StringFromMIRType(mir()->type()); }
23 };
24
25 class LDivOrModI64
26 : public LCallInstructionHelper<INT64_PIECES, INT64_PIECES * 2 + 1, 0> {
27 public:
28 LIR_HEADER(DivOrModI64)
29
30 static const size_t Lhs = 0;
31 static const size_t Rhs = INT64_PIECES;
32 static const size_t Instance = 2 * INT64_PIECES;
33
34 LDivOrModI64(const LInt64Allocation& lhs, const LInt64Allocation& rhs,
35 const LAllocation& instance)
36 : LCallInstructionHelper(classOpcode) {
37 setInt64Operand(Lhs, lhs);
38 setInt64Operand(Rhs, rhs);
39 setOperand(Instance, instance);
40 }
41
42 LInt64Allocation lhs() const { return getInt64Operand(Lhs); }
43 LInt64Allocation rhs() const { return getInt64Operand(Rhs); }
44 const LAllocation* instance() const { return getOperand(Instance); }
45
46 MDefinition* mir() const {
47 MOZ_ASSERT(mir_->isWasmBuiltinDivI64() || mir_->isWasmBuiltinModI64());
48 return mir_;
49 }
50 bool canBeDivideByZero() const {
51 if (mir_->isWasmBuiltinModI64()) {
52 return mir_->toWasmBuiltinModI64()->canBeDivideByZero();
53 }
54 return mir_->toWasmBuiltinDivI64()->canBeDivideByZero();
55 }
56 bool canBeNegativeOverflow() const {
57 if (mir_->isWasmBuiltinModI64()) {
58 return mir_->toWasmBuiltinModI64()->canBeNegativeDividend();
59 }
60 return mir_->toWasmBuiltinDivI64()->canBeNegativeOverflow();
61 }
62 const wasm::TrapSiteDesc& trapSiteDesc() const {
63 MOZ_ASSERT(mir_->isWasmBuiltinDivI64() || mir_->isWasmBuiltinModI64());
64 if (mir_->isWasmBuiltinModI64()) {
65 return mir_->toWasmBuiltinModI64()->trapSiteDesc();
66 }
67 return mir_->toWasmBuiltinDivI64()->trapSiteDesc();
68 }
69 };
70
71 class LUDivOrModI64
72 : public LCallInstructionHelper<INT64_PIECES, INT64_PIECES * 2 + 1, 0> {
73 public:
74 LIR_HEADER(UDivOrModI64)
75
76 static const size_t Lhs = 0;
77 static const size_t Rhs = INT64_PIECES;
78 static const size_t Instance = 2 * INT64_PIECES;
79
80 LUDivOrModI64(const LInt64Allocation& lhs, const LInt64Allocation& rhs,
81 const LAllocation& instance)
82 : LCallInstructionHelper(classOpcode) {
83 setInt64Operand(Lhs, lhs);
84 setInt64Operand(Rhs, rhs);
85 setOperand(Instance, instance);
86 }
87
88 LInt64Allocation lhs() const { return getInt64Operand(Lhs); }
89 LInt64Allocation rhs() const { return getInt64Operand(Rhs); }
90 const LAllocation* instance() const { return getOperand(Instance); }
91
92 MDefinition* mir() const {
93 MOZ_ASSERT(mir_->isWasmBuiltinDivI64() || mir_->isWasmBuiltinModI64());
94 return mir_;
95 }
96 bool canBeDivideByZero() const {
97 if (mir_->isWasmBuiltinModI64()) {
98 return mir_->toWasmBuiltinModI64()->canBeDivideByZero();
99 }
100 return mir_->toWasmBuiltinDivI64()->canBeDivideByZero();
101 }
102 bool canBeNegativeOverflow() const {
103 if (mir_->isWasmBuiltinModI64()) {
104 return mir_->toWasmBuiltinModI64()->canBeNegativeDividend();
105 }
106 return mir_->toWasmBuiltinDivI64()->canBeNegativeOverflow();
107 }
108 const wasm::TrapSiteDesc& trapSiteDesc() const {
109 MOZ_ASSERT(mir_->isWasmBuiltinDivI64() || mir_->isWasmBuiltinModI64());
110 if (mir_->isWasmBuiltinModI64()) {
111 return mir_->toWasmBuiltinModI64()->trapSiteDesc();
112 }
113 return mir_->toWasmBuiltinDivI64()->trapSiteDesc();
114 }
115 };
116
117 // Definitions for `extraName` methods of generated LIR instructions.
118
119 #ifdef JS_JITSPEW
120 const char* LBoxFloatingPoint::extraName() const {
121 return StringFromMIRType(type_);
122 }
123 #endif
124
125 } // namespace jit
126 } // namespace js
127
128 #endif /* jit_arm_LIR_arm_h */