Debian Codegraph @

js/src/jit/mips64/LIR-mips64.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_mips64_LIR_mips64_h
8 #define jit_mips64_LIR_mips64_h
9
10 namespace js {
11 namespace jit {
12
13 class LUnbox : public LInstructionHelper<1, BOX_PIECES, 0> {
14 public:
15 LIR_HEADER(Unbox);
16
17 explicit LUnbox(const LAllocation& input) : LInstructionHelper(classOpcode) {
18 setOperand(0, input);
19 }
20
21 static const size_t Input = 0;
22
23 LBoxAllocation input() const { return getBoxOperand(Input); }
24
25 MUnbox* mir() const { return mir_->toUnbox(); }
26 const char* extraName() const { return StringFromMIRType(mir()->type()); }
27 };
28
29 class LDivOrModI64 : public LBinaryMath<1> {
30 public:
31 LIR_HEADER(DivOrModI64)
32
33 LDivOrModI64(const LAllocation& lhs, const LAllocation& rhs,
34 const LDefinition& temp)
35 : LBinaryMath(classOpcode) {
36 setOperand(0, lhs);
37 setOperand(1, rhs);
38 setTemp(0, temp);
39 }
40
41 const LDefinition* remainder() { return getTemp(0); }
42 MBinaryArithInstruction* mir() const {
43 MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
44 return static_cast<MBinaryArithInstruction*>(mir_);
45 }
46
47 bool canBeDivideByZero() const {
48 if (mir_->isMod()) {
49 return mir_->toMod()->canBeDivideByZero();
50 }
51 return mir_->toDiv()->canBeDivideByZero();
52 }
53 bool canBeNegativeOverflow() const {
54 if (mir_->isMod()) {
55 return mir_->toMod()->canBeNegativeDividend();
56 }
57 return mir_->toDiv()->canBeNegativeOverflow();
58 }
59 wasm::TrapSiteDesc trapSiteDesc() const {
60 MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
61 if (mir_->isMod()) {
62 return mir_->toMod()->trapSiteDesc();
63 }
64 return mir_->toDiv()->trapSiteDesc();
65 }
66 };
67
68 class LUDivOrModI64 : public LBinaryMath<1> {
69 public:
70 LIR_HEADER(UDivOrModI64);
71
72 LUDivOrModI64(const LAllocation& lhs, const LAllocation& rhs,
73 const LDefinition& temp)
74 : LBinaryMath(classOpcode) {
75 setOperand(0, lhs);
76 setOperand(1, rhs);
77 setTemp(0, temp);
78 }
79
80 const LDefinition* remainder() { return getTemp(0); }
81 const char* extraName() const {
82 return mir()->isTruncated() ? "Truncated" : nullptr;
83 }
84
85 MBinaryArithInstruction* mir() const {
86 MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
87 return static_cast<MBinaryArithInstruction*>(mir_);
88 }
89 bool canBeDivideByZero() const {
90 if (mir_->isMod()) {
91 return mir_->toMod()->canBeDivideByZero();
92 }
93 return mir_->toDiv()->canBeDivideByZero();
94 }
95 wasm::TrapSiteDesc trapSiteDesc() const {
96 MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
97 if (mir_->isMod()) {
98 return mir_->toMod()->trapSiteDesc();
99 }
100 return mir_->toDiv()->trapSiteDesc();
101 }
102 };
103
104 } // namespace jit
105 } // namespace js
106
107 #endif /* jit_mips64_LIR_mips64_h */