Line data Source code
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_x64_Lowering_x64_h
8 : #define jit_x64_Lowering_x64_h
9 :
10 : #include "jit/x86-shared/Lowering-x86-shared.h"
11 :
12 : namespace js {
13 : namespace jit {
14 :
15 : class LIRGeneratorX64 : public LIRGeneratorX86Shared
16 : {
17 : public:
18 8 : LIRGeneratorX64(MIRGenerator* gen, MIRGraph& graph, LIRGraph& lirGraph)
19 8 : : LIRGeneratorX86Shared(gen, graph, lirGraph)
20 8 : { }
21 :
22 : protected:
23 : void lowerUntypedPhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block, size_t lirIndex);
24 : void defineUntypedPhi(MPhi* phi, size_t lirIndex);
25 : void lowerInt64PhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block, size_t lirIndex);
26 : void defineInt64Phi(MPhi* phi, size_t lirIndex);
27 :
28 : void lowerForALUInt64(LInstructionHelper<INT64_PIECES, 2 * INT64_PIECES, 0>* ins,
29 : MDefinition* mir, MDefinition* lhs, MDefinition* rhs);
30 : void lowerForMulInt64(LMulI64* ins, MMul* mir, MDefinition* lhs, MDefinition* rhs);
31 :
32 : // Returns a box allocation. reg2 is ignored on 64-bit platforms.
33 : LBoxAllocation useBoxFixed(MDefinition* mir, Register reg1, Register, bool useAtStart = false);
34 :
35 : // x86 has constraints on what registers can be formatted for 1-byte
36 : // stores and loads; on x64 all registers are okay.
37 : LAllocation useByteOpRegister(MDefinition* mir);
38 : LAllocation useByteOpRegisterAtStart(MDefinition* mir);
39 : LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition* mir);
40 : LDefinition tempByteOpRegister();
41 :
42 : LDefinition tempToUnbox();
43 :
44 2 : bool needTempForPostBarrier() { return true; }
45 :
46 : void lowerDivI64(MDiv* div);
47 : void lowerModI64(MMod* mod);
48 : void lowerUDivI64(MDiv* div);
49 : void lowerUModI64(MMod* mod);
50 :
51 : public:
52 : void visitBox(MBox* box);
53 : void visitUnbox(MUnbox* unbox);
54 : void visitReturn(MReturn* ret);
55 : void visitCompareExchangeTypedArrayElement(MCompareExchangeTypedArrayElement* ins);
56 : void visitAtomicExchangeTypedArrayElement(MAtomicExchangeTypedArrayElement* ins);
57 : void visitAtomicTypedArrayElementBinop(MAtomicTypedArrayElementBinop* ins);
58 : void visitWasmUnsignedToDouble(MWasmUnsignedToDouble* ins);
59 : void visitWasmUnsignedToFloat32(MWasmUnsignedToFloat32* ins);
60 : void visitAsmJSLoadHeap(MAsmJSLoadHeap* ins);
61 : void visitAsmJSStoreHeap(MAsmJSStoreHeap* ins);
62 : void visitAsmJSCompareExchangeHeap(MAsmJSCompareExchangeHeap* ins);
63 : void visitAsmJSAtomicExchangeHeap(MAsmJSAtomicExchangeHeap* ins);
64 : void visitAsmJSAtomicBinopHeap(MAsmJSAtomicBinopHeap* ins);
65 : void visitWasmLoad(MWasmLoad* ins);
66 : void visitWasmStore(MWasmStore* ins);
67 : void visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic* ins);
68 : void visitSubstr(MSubstr* ins);
69 : void visitRandom(MRandom* ins);
70 : void visitWasmTruncateToInt64(MWasmTruncateToInt64* ins);
71 : void visitInt64ToFloatingPoint(MInt64ToFloatingPoint* ins);
72 : void visitExtendInt32ToInt64(MExtendInt32ToInt64* ins);
73 : };
74 :
75 : typedef LIRGeneratorX64 LIRGeneratorSpecific;
76 :
77 : } // namespace jit
78 : } // namespace js
79 :
80 : #endif /* jit_x64_Lowering_x64_h */
|