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/. */
10 // This file declares the structures that are used for attaching LIR to a
14 #if defined(JS_CODEGEN_X86)
15 # include "jit/x86/Lowering-x86.h"
16 #elif defined(JS_CODEGEN_X64)
17 # include "jit/x64/Lowering-x64.h"
18 #elif defined(JS_CODEGEN_ARM)
19 # include "jit/arm/Lowering-arm.h"
20 #elif defined(JS_CODEGEN_ARM64)
21 # include "jit/arm64/Lowering-arm64.h"
22 #elif defined(JS_CODEGEN_MIPS32)
23 # include "jit/mips32/Lowering-mips32.h"
24 #elif defined(JS_CODEGEN_MIPS64)
25 # include "jit/mips64/Lowering-mips64.h"
26 #elif defined(JS_CODEGEN_LOONG64)
27 # include "jit/loong64/Lowering-loong64.h"
28 #elif defined(JS_CODEGEN_RISCV64)
29 # include "jit/riscv64/Lowering-riscv64.h"
30 #elif defined(JS_CODEGEN_WASM32)
31 # include "jit/wasm32/Lowering-wasm32.h"
32 #elif defined(JS_CODEGEN_NONE)
33 # include "jit/none/Lowering-none.h"
35 # error "Unknown architecture!"
41 class LIRGenerator final
: public LIRGeneratorSpecific
{
42 void updateResumeState(MInstruction
* ins
);
43 void updateResumeState(MBasicBlock
* block
);
45 // The maximum depth, for framesizeclass determination.
46 uint32_t maxargslots_
;
49 LIRGenerator(MIRGenerator
* gen
, MIRGraph
& graph
, LIRGraph
& lirGraph
)
50 : LIRGeneratorSpecific(gen
, graph
, lirGraph
), maxargslots_(0) {}
52 [[nodiscard
]] bool generate();
55 LBoxAllocation
useBoxFixedAtStart(MDefinition
* mir
, Register reg1
,
57 return useBoxFixed(mir
, reg1
, reg2
, /* useAtStart = */ true);
60 LBoxAllocation
useBoxFixedAtStart(MDefinition
* mir
, ValueOperand op
);
61 LBoxAllocation
useBoxAtStart(MDefinition
* mir
,
62 LUse::Policy policy
= LUse::REGISTER
);
64 void lowerBitOp(JSOp op
, MBinaryInstruction
* ins
);
65 void lowerShiftOp(JSOp op
, MShiftInstruction
* ins
);
66 LInstructionHelper
<1, 1, 0>* allocateAbs(MAbs
* ins
, LAllocation input
);
70 [[nodiscard
]] bool lowerCallArguments(T
* call
);
72 friend class LIRGeneratorShared
;
73 void visitInstructionDispatch(MInstruction
* ins
);
75 void visitReturnImpl(MDefinition
* def
, bool isGenerator
= false);
77 [[nodiscard
]] bool visitInstruction(MInstruction
* ins
);
78 [[nodiscard
]] bool visitBlock(MBasicBlock
* block
);
80 #define MIR_OP(op) void visit##op(M##op* ins);
81 MIR_OPCODE_LIST(MIR_OP
)
84 template <class MWasmCallT
>
85 void visitWasmCall(MWasmCallT ins
);
87 WasmRefIsSubtypeDefs
useWasmRefIsSubtype(wasm::RefType destType
,
88 MDefinition
* superSTV
);
94 #endif /* jit_Lowering_h */