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_x86_Lowering_x86_h michael@0: #define jit_x86_Lowering_x86_h michael@0: michael@0: #include "jit/shared/Lowering-x86-shared.h" michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: class LIRGeneratorX86 : public LIRGeneratorX86Shared michael@0: { michael@0: public: michael@0: LIRGeneratorX86(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) michael@0: : LIRGeneratorX86Shared(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: // It's a trap! On x86, the 1-byte store can only use one of michael@0: // {al,bl,cl,dl,ah,bh,ch,dh}. That means if the register allocator michael@0: // gives us one of {edi,esi,ebp,esp}, we're out of luck. (The formatter michael@0: // will assert on us.) Ideally, we'd just ask the register allocator to michael@0: // give us one of {al,bl,cl,dl}. For now, just useFixed(al). 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: bool needTempForPostBarrier() { return true; } michael@0: michael@0: LDefinition tempForDispatchCache(MIRType outputType = MIRType_None); 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: michael@0: public: michael@0: bool visitBox(MBox *box); michael@0: bool visitUnbox(MUnbox *unbox); michael@0: bool visitReturn(MReturn *ret); 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 lowerPhi(MPhi *phi); michael@0: michael@0: static bool allowTypedElementHoleCheck() { michael@0: return true; michael@0: } michael@0: michael@0: static bool allowStaticTypedArrayAccesses() { michael@0: return true; michael@0: } michael@0: michael@0: static bool allowFloat32Optimizations() { michael@0: return true; michael@0: } michael@0: michael@0: static bool allowInlineForkJoinGetSlice() { michael@0: return true; michael@0: } michael@0: }; michael@0: michael@0: typedef LIRGeneratorX86 LIRGeneratorSpecific; michael@0: michael@0: } // namespace js michael@0: } // namespace jit michael@0: michael@0: #endif /* jit_x86_Lowering_x86_h */