1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * vim: set ts=8 sts=4 et sw=4 tw=99:
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_x86_shared_Lowering_x86_shared_h
8 #define jit_x86_shared_Lowering_x86_shared_h
9 
10 #include "jit/shared/Lowering-shared.h"
11 
12 namespace js {
13 namespace jit {
14 
15 class LIRGeneratorX86Shared : public LIRGeneratorShared {
16  protected:
LIRGeneratorX86Shared(MIRGenerator * gen,MIRGraph & graph,LIRGraph & lirGraph)17   LIRGeneratorX86Shared(MIRGenerator* gen, MIRGraph& graph, LIRGraph& lirGraph)
18       : LIRGeneratorShared(gen, graph, lirGraph) {}
19 
20   LTableSwitch* newLTableSwitch(const LAllocation& in,
21                                 const LDefinition& inputCopy,
22                                 MTableSwitch* ins);
23   LTableSwitchV* newLTableSwitchV(MTableSwitch* ins);
24 
25   void visitPowHalf(MPowHalf* ins) override;
26   void lowerForShift(LInstructionHelper<1, 2, 0>* ins, MDefinition* mir,
27                      MDefinition* lhs, MDefinition* rhs);
28   void lowerForALU(LInstructionHelper<1, 1, 0>* ins, MDefinition* mir,
29                    MDefinition* input);
30   void lowerForALU(LInstructionHelper<1, 2, 0>* ins, MDefinition* mir,
31                    MDefinition* lhs, MDefinition* rhs);
32 
33   template <size_t Temps>
34   void lowerForShiftInt64(
35       LInstructionHelper<INT64_PIECES, INT64_PIECES + 1, Temps>* ins,
36       MDefinition* mir, MDefinition* lhs, MDefinition* rhs);
37 
38   template <size_t Temps>
39   void lowerForFPU(LInstructionHelper<1, 2, Temps>* ins, MDefinition* mir,
40                    MDefinition* lhs, MDefinition* rhs);
41   void lowerForCompIx4(LSimdBinaryCompIx4* ins, MSimdBinaryComp* mir,
42                        MDefinition* lhs, MDefinition* rhs);
43   void lowerForCompFx4(LSimdBinaryCompFx4* ins, MSimdBinaryComp* mir,
44                        MDefinition* lhs, MDefinition* rhs);
45   void lowerForBitAndAndBranch(LBitAndAndBranch* baab, MInstruction* mir,
46                                MDefinition* lhs, MDefinition* rhs);
47   void visitWasmNeg(MWasmNeg* ins) override;
48   void visitWasmSelect(MWasmSelect* ins) override;
49   void lowerMulI(MMul* mul, MDefinition* lhs, MDefinition* rhs);
50   void lowerDivI(MDiv* div);
51   void lowerModI(MMod* mod);
52   void lowerUDiv(MDiv* div);
53   void lowerUMod(MMod* mod);
54   void lowerUrshD(MUrsh* mir);
55   void lowerTruncateDToInt32(MTruncateToInt32* ins);
56   void lowerTruncateFToInt32(MTruncateToInt32* ins);
57   void visitSimdInsertElement(MSimdInsertElement* ins) override;
58   void visitSimdExtractElement(MSimdExtractElement* ins) override;
59   void visitSimdBinaryArith(MSimdBinaryArith* ins) override;
60   void visitSimdBinarySaturating(MSimdBinarySaturating* ins) override;
61   void visitSimdSelect(MSimdSelect* ins) override;
62   void visitSimdSplat(MSimdSplat* ins) override;
63   void visitSimdSwizzle(MSimdSwizzle* ins) override;
64   void visitSimdShuffle(MSimdShuffle* ins) override;
65   void visitSimdGeneralShuffle(MSimdGeneralShuffle* ins) override;
66   void visitSimdValueX4(MSimdValueX4* ins) override;
67   void lowerCompareExchangeTypedArrayElement(
68       MCompareExchangeTypedArrayElement* ins, bool useI386ByteRegisters);
69   void lowerAtomicExchangeTypedArrayElement(
70       MAtomicExchangeTypedArrayElement* ins, bool useI386ByteRegisters);
71   void lowerAtomicTypedArrayElementBinop(MAtomicTypedArrayElementBinop* ins,
72                                          bool useI386ByteRegisters);
73   void visitCopySign(MCopySign* ins) override;
74 };
75 
76 }  // namespace jit
77 }  // namespace js
78 
79 #endif /* jit_x86_shared_Lowering_x86_shared_h */
80