|
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_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 { |
|
17 public: |
|
18 LIRGeneratorARM(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) |
|
19 : LIRGeneratorShared(gen, graph, lirGraph) |
|
20 { } |
|
21 |
|
22 protected: |
|
23 // Adds a box input to an instruction, setting operand |n| to the type and |
|
24 // |n+1| to the payload. |
|
25 bool useBox(LInstruction *lir, size_t n, MDefinition *mir, |
|
26 LUse::Policy policy = LUse::REGISTER, bool useAtStart = false); |
|
27 bool useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2); |
|
28 |
|
29 // x86 has constraints on what registers can be formatted for 1-byte |
|
30 // stores and loads; on ARM all registers are okay. |
|
31 LAllocation useByteOpRegister(MDefinition *mir); |
|
32 LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition *mir); |
|
33 |
|
34 inline LDefinition tempToUnbox() { |
|
35 return LDefinition::BogusTemp(); |
|
36 } |
|
37 |
|
38 bool needTempForPostBarrier() { return false; } |
|
39 |
|
40 // x64 has a scratch register, so no need for another temp for dispatch |
|
41 // ICs. |
|
42 LDefinition tempForDispatchCache(MIRType outputType = MIRType_None) { |
|
43 return LDefinition::BogusTemp(); |
|
44 } |
|
45 |
|
46 void lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock *block, size_t lirIndex); |
|
47 bool defineUntypedPhi(MPhi *phi, size_t lirIndex); |
|
48 bool lowerForShift(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir, MDefinition *lhs, |
|
49 MDefinition *rhs); |
|
50 bool lowerUrshD(MUrsh *mir); |
|
51 |
|
52 bool lowerForALU(LInstructionHelper<1, 1, 0> *ins, MDefinition *mir, |
|
53 MDefinition *input); |
|
54 bool lowerForALU(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir, |
|
55 MDefinition *lhs, MDefinition *rhs); |
|
56 |
|
57 bool lowerForFPU(LInstructionHelper<1, 1, 0> *ins, MDefinition *mir, |
|
58 MDefinition *src); |
|
59 bool lowerForFPU(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir, |
|
60 MDefinition *lhs, MDefinition *rhs); |
|
61 bool lowerForBitAndAndBranch(LBitAndAndBranch *baab, MInstruction *mir, |
|
62 MDefinition *lhs, MDefinition *rhs); |
|
63 bool lowerConstantDouble(double d, MInstruction *ins); |
|
64 bool lowerConstantFloat32(float d, MInstruction *ins); |
|
65 bool lowerTruncateDToInt32(MTruncateToInt32 *ins); |
|
66 bool lowerTruncateFToInt32(MTruncateToInt32 *ins); |
|
67 bool lowerDivI(MDiv *div); |
|
68 bool lowerModI(MMod *mod); |
|
69 bool lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs); |
|
70 bool lowerUDiv(MDiv *div); |
|
71 bool lowerUMod(MMod *mod); |
|
72 bool visitPowHalf(MPowHalf *ins); |
|
73 bool visitAsmJSNeg(MAsmJSNeg *ins); |
|
74 |
|
75 LTableSwitch *newLTableSwitch(const LAllocation &in, const LDefinition &inputCopy, |
|
76 MTableSwitch *ins); |
|
77 LTableSwitchV *newLTableSwitchV(MTableSwitch *ins); |
|
78 |
|
79 public: |
|
80 bool visitConstant(MConstant *ins); |
|
81 bool visitBox(MBox *box); |
|
82 bool visitUnbox(MUnbox *unbox); |
|
83 bool visitReturn(MReturn *ret); |
|
84 bool lowerPhi(MPhi *phi); |
|
85 bool visitGuardShape(MGuardShape *ins); |
|
86 bool visitGuardObjectType(MGuardObjectType *ins); |
|
87 bool visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins); |
|
88 bool visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins); |
|
89 bool visitAsmJSLoadHeap(MAsmJSLoadHeap *ins); |
|
90 bool visitAsmJSStoreHeap(MAsmJSStoreHeap *ins); |
|
91 bool visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr *ins); |
|
92 bool visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic *ins); |
|
93 bool visitForkJoinGetSlice(MForkJoinGetSlice *ins); |
|
94 |
|
95 static bool allowFloat32Optimizations() { |
|
96 return true; |
|
97 } |
|
98 }; |
|
99 |
|
100 typedef LIRGeneratorARM LIRGeneratorSpecific; |
|
101 |
|
102 } // namespace jit |
|
103 } // namespace js |
|
104 |
|
105 #endif /* jit_arm_Lowering_arm_h */ |