michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef jit_mips_Lowering_mips_h michael@0: #define jit_mips_Lowering_mips_h michael@0: michael@0: #include "jit/shared/Lowering-shared.h" michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: class LIRGeneratorMIPS : public LIRGeneratorShared michael@0: { michael@0: protected: michael@0: LIRGeneratorMIPS(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) michael@0: : LIRGeneratorShared(gen, graph, lirGraph) michael@0: { } michael@0: michael@0: protected: michael@0: // Adds a box input to an instruction, setting operand |n| to the type and michael@0: // |n+1| to the payload. michael@0: bool useBox(LInstruction *lir, size_t n, MDefinition *mir, michael@0: LUse::Policy policy = LUse::REGISTER, bool useAtStart = false); michael@0: bool useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2); michael@0: michael@0: // x86 has constraints on what registers can be formatted for 1-byte michael@0: // stores and loads; on MIPS all registers are okay. michael@0: LAllocation useByteOpRegister(MDefinition *mir); michael@0: LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition *mir); michael@0: michael@0: inline LDefinition tempToUnbox() { michael@0: return LDefinition::BogusTemp(); michael@0: } michael@0: michael@0: // MIPS has a scratch register, so no need for another temp for dispatch michael@0: // ICs. michael@0: LDefinition tempForDispatchCache(MIRType outputType = MIRType_None) { michael@0: return LDefinition::BogusTemp(); michael@0: } michael@0: michael@0: void lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock *block, size_t lirIndex); michael@0: bool defineUntypedPhi(MPhi *phi, size_t lirIndex); michael@0: bool lowerForShift(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir, MDefinition *lhs, michael@0: MDefinition *rhs); michael@0: bool lowerUrshD(MUrsh *mir); michael@0: michael@0: bool lowerForALU(LInstructionHelper<1, 1, 0> *ins, MDefinition *mir, michael@0: MDefinition *input); michael@0: bool lowerForALU(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir, michael@0: MDefinition *lhs, MDefinition *rhs); michael@0: michael@0: bool lowerForFPU(LInstructionHelper<1, 1, 0> *ins, MDefinition *mir, michael@0: MDefinition *src); michael@0: bool lowerForFPU(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir, michael@0: MDefinition *lhs, MDefinition *rhs); michael@0: bool lowerForBitAndAndBranch(LBitAndAndBranch *baab, MInstruction *mir, michael@0: MDefinition *lhs, MDefinition *rhs); michael@0: bool lowerConstantDouble(double d, MInstruction *ins); michael@0: bool lowerConstantFloat32(float d, MInstruction *ins); michael@0: bool lowerTruncateDToInt32(MTruncateToInt32 *ins); michael@0: bool lowerTruncateFToInt32(MTruncateToInt32 *ins); michael@0: bool lowerDivI(MDiv *div); michael@0: bool lowerModI(MMod *mod); michael@0: bool lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs); michael@0: bool lowerUDiv(MDiv *div); michael@0: bool lowerUMod(MMod *mod); michael@0: bool visitPowHalf(MPowHalf *ins); michael@0: bool visitAsmJSNeg(MAsmJSNeg *ins); michael@0: michael@0: LTableSwitch *newLTableSwitch(const LAllocation &in, const LDefinition &inputCopy, michael@0: MTableSwitch *ins); michael@0: LTableSwitchV *newLTableSwitchV(MTableSwitch *ins); michael@0: michael@0: public: michael@0: bool visitConstant(MConstant *ins); michael@0: bool visitBox(MBox *box); michael@0: bool visitUnbox(MUnbox *unbox); michael@0: bool visitReturn(MReturn *ret); michael@0: bool lowerPhi(MPhi *phi); michael@0: bool visitGuardShape(MGuardShape *ins); michael@0: bool visitGuardObjectType(MGuardObjectType *ins); michael@0: bool visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins); michael@0: bool visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins); michael@0: bool visitAsmJSLoadHeap(MAsmJSLoadHeap *ins); michael@0: bool visitAsmJSStoreHeap(MAsmJSStoreHeap *ins); michael@0: bool visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr *ins); michael@0: bool visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic *ins); michael@0: bool visitForkJoinGetSlice(MForkJoinGetSlice *ins); michael@0: michael@0: static bool allowFloat32Optimizations() { michael@0: return true; michael@0: } michael@0: }; michael@0: michael@0: typedef LIRGeneratorMIPS LIRGeneratorSpecific; michael@0: michael@0: } // namespace jit michael@0: } // namespace js michael@0: michael@0: #endif /* jit_mips_Lowering_mips_h */