| 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_Lowering_arm_h |
| 8 |
#define jit_arm_Lowering_arm_h |
| 9 |
|
| 10 |
#include "jit/shared/Lowering-shared.h" |
| 11 |
|
| 12 |
namespace js { |
| 13 |
namespace jit { |
| 14 |
|
| 15 |
class LIRGeneratorARM : public LIRGeneratorShared { |
| 16 |
protected: |
| 17 |
LIRGeneratorARM(MIRGenerator* gen, MIRGraph& graph, LIRGraph& lirGraph) |
| 18 |
: LIRGeneratorShared(gen, graph, lirGraph) {} |
| 19 |
|
| 20 |
// Returns a box allocation with type set to reg1 and payload set to reg2. |
| 21 |
LBoxAllocation useBoxFixed(MDefinition* mir, Register reg1, Register reg2, |
| 22 |
bool useAtStart = false); |
| 23 |
|
| 24 |
// x86 has constraints on what registers can be formatted for 1-byte |
| 25 |
// stores and loads; on ARM all registers are okay. |
| 26 |
LAllocation useByteOpRegister(MDefinition* mir); |
| 27 |
LAllocation useByteOpRegisterAtStart(MDefinition* mir); |
| 28 |
LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition* mir); |
| 29 |
LDefinition tempByteOpRegister(); |
| 30 |
|
| 31 |
inline LDefinition tempToUnbox() { return LDefinition::BogusTemp(); } |
| 32 |
|
| 33 |
bool needTempForPostBarrier() { return false; } |
| 34 |
|
| 35 |
void lowerUntypedPhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block, |
| 36 |
size_t lirIndex); |
| 37 |
void lowerInt64PhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block, |
| 38 |
size_t lirIndex); |
| 39 |
void defineInt64Phi(MPhi* phi, size_t lirIndex); |
| 40 |
|
| 41 |
void lowerForShift(LInstructionHelper<1, 2, 0>* ins, MDefinition* mir, |
| 42 |
MDefinition* lhs, MDefinition* rhs); |
| 43 |
void lowerUrshD(MUrsh* mir); |
| 44 |
|
| 45 |
void lowerPowOfTwoI(MPow* mir); |
| 46 |
|
| 47 |
void lowerForALU(LInstructionHelper<1, 1, 0>* ins, MDefinition* mir, |
| 48 |
MDefinition* input); |
| 49 |
void lowerForALU(LInstructionHelper<1, 2, 0>* ins, MDefinition* mir, |
| 50 |
MDefinition* lhs, MDefinition* rhs); |
| 51 |
|
| 52 |
void lowerForALUInt64(LInstructionHelper<INT64_PIECES, INT64_PIECES, 0>* ins, |
| 53 |
MDefinition* mir, MDefinition* input); |
| 54 |
void lowerForALUInt64( |
| 55 |
LInstructionHelper<INT64_PIECES, 2 * INT64_PIECES, 0>* ins, |
| 56 |
MDefinition* mir, MDefinition* lhs, MDefinition* rhs); |
| 57 |
void lowerForMulInt64(LMulI64* ins, MMul* mir, MDefinition* lhs, |
| 58 |
MDefinition* rhs); |
| 59 |
template <class LInstr> |
| 60 |
void lowerForShiftInt64(LInstr* ins, MDefinition* mir, MDefinition* lhs, |
| 61 |
MDefinition* rhs); |
| 62 |
|
| 63 |
void lowerForFPU(LInstructionHelper<1, 1, 0>* ins, MDefinition* mir, |
| 64 |
MDefinition* src); |
| 65 |
template <size_t Temps> |
| 66 |
void lowerForFPU(LInstructionHelper<1, 2, Temps>* ins, MDefinition* mir, |
| 67 |
MDefinition* lhs, MDefinition* rhs); |
| 68 |
|
| 69 |
void lowerBuiltinInt64ToFloatingPoint(MBuiltinInt64ToFloatingPoint* ins); |
| 70 |
void lowerWasmBuiltinTruncateToInt64(MWasmBuiltinTruncateToInt64* ins); |
| 71 |
void lowerWasmBuiltinTruncateToInt32(MWasmBuiltinTruncateToInt32* ins); |
| 72 |
void lowerTruncateDToInt32(MTruncateToInt32* ins); |
| 73 |
void lowerTruncateFToInt32(MTruncateToInt32* ins); |
| 74 |
void lowerDivI(MDiv* div); |
| 75 |
void lowerModI(MMod* mod); |
| 76 |
void lowerDivI64(MDiv* div); |
| 77 |
void lowerWasmBuiltinDivI64(MWasmBuiltinDivI64* div); |
| 78 |
void lowerModI64(MMod* mod); |
| 79 |
void lowerWasmBuiltinModI64(MWasmBuiltinModI64* mod); |
| 80 |
void lowerUDivI64(MDiv* div); |
| 81 |
void lowerUModI64(MMod* mod); |
| 82 |
void lowerNegI(MInstruction* ins, MDefinition* input); |
| 83 |
void lowerNegI64(MInstruction* ins, MDefinition* input); |
| 84 |
void lowerMulI(MMul* mul, MDefinition* lhs, MDefinition* rhs); |
| 85 |
void lowerUDiv(MDiv* div); |
| 86 |
void lowerUMod(MMod* mod); |
| 87 |
void lowerWasmSelectI(MWasmSelect* select); |
| 88 |
void lowerWasmSelectI64(MWasmSelect* select); |
| 89 |
|
| 90 |
void lowerBigIntPtrLsh(MBigIntPtrLsh* ins); |
| 91 |
void lowerBigIntPtrRsh(MBigIntPtrRsh* ins); |
| 92 |
void lowerBigIntPtrDiv(MBigIntPtrDiv* ins); |
| 93 |
void lowerBigIntPtrMod(MBigIntPtrMod* ins); |
| 94 |
|
| 95 |
void lowerAtomicLoad64(MLoadUnboxedScalar* ins); |
| 96 |
void lowerAtomicStore64(MStoreUnboxedScalar* ins); |
| 97 |
|
| 98 |
LTableSwitch* newLTableSwitch(const LAllocation& in, |
| 99 |
const LDefinition& inputCopy); |
| 100 |
LTableSwitchV* newLTableSwitchV(const LBoxAllocation& in); |
| 101 |
|
| 102 |
void lowerPhi(MPhi* phi); |
| 103 |
}; |
| 104 |
|
| 105 |
using LIRGeneratorSpecific = LIRGeneratorARM; |
| 106 |
|
| 107 |
} // namespace jit |
| 108 |
} // namespace js |
| 109 |
|
| 110 |
#endif /* jit_arm_Lowering_arm_h */ |