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_x64_LIR_x64_h michael@0: #define jit_x64_LIR_x64_h michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: // Given a typed input, returns an untyped box. michael@0: class LBox : public LInstructionHelper<1, 1, 0> michael@0: { michael@0: MIRType type_; michael@0: michael@0: public: michael@0: LIR_HEADER(Box) michael@0: michael@0: LBox(MIRType type, const LAllocation &payload) michael@0: : type_(type) michael@0: { michael@0: setOperand(0, payload); michael@0: } michael@0: michael@0: MIRType type() const { michael@0: return type_; michael@0: } michael@0: const char *extraName() const { michael@0: return StringFromMIRType(type_); michael@0: } michael@0: }; michael@0: michael@0: // Given an untyped input, guards on whether it's a specific type and returns michael@0: // the unboxed payload. michael@0: class LUnboxBase : public LInstructionHelper<1, 1, 0> michael@0: { michael@0: public: michael@0: LUnboxBase(const LAllocation &input) { michael@0: setOperand(0, input); michael@0: } michael@0: michael@0: static const size_t Input = 0; michael@0: michael@0: MUnbox *mir() const { michael@0: return mir_->toUnbox(); michael@0: } michael@0: }; michael@0: michael@0: class LUnbox : public LUnboxBase { michael@0: public: michael@0: LIR_HEADER(Unbox) michael@0: michael@0: LUnbox(const LAllocation &input) michael@0: : LUnboxBase(input) michael@0: { } michael@0: michael@0: const char *extraName() const { michael@0: return StringFromMIRType(mir()->type()); michael@0: } michael@0: }; michael@0: michael@0: class LUnboxFloatingPoint : public LUnboxBase { michael@0: MIRType type_; michael@0: michael@0: public: michael@0: LIR_HEADER(UnboxFloatingPoint) michael@0: michael@0: LUnboxFloatingPoint(const LAllocation &input, MIRType type) michael@0: : LUnboxBase(input), michael@0: type_(type) michael@0: { } michael@0: michael@0: MIRType type() const { michael@0: return type_; michael@0: } michael@0: const char *extraName() const { michael@0: return StringFromMIRType(type_); michael@0: } michael@0: }; michael@0: michael@0: // Convert a 32-bit unsigned integer to a double. michael@0: class LAsmJSUInt32ToDouble : public LInstructionHelper<1, 1, 0> michael@0: { michael@0: public: michael@0: LIR_HEADER(AsmJSUInt32ToDouble) michael@0: michael@0: LAsmJSUInt32ToDouble(const LAllocation &input) { michael@0: setOperand(0, input); michael@0: } michael@0: }; michael@0: michael@0: // Convert a 32-bit unsigned integer to a float32. michael@0: class LAsmJSUInt32ToFloat32 : public LInstructionHelper<1, 1, 0> michael@0: { michael@0: public: michael@0: LIR_HEADER(AsmJSUInt32ToFloat32) michael@0: michael@0: LAsmJSUInt32ToFloat32(const LAllocation &input) { michael@0: setOperand(0, input); michael@0: } michael@0: }; michael@0: michael@0: class LAsmJSLoadFuncPtr : public LInstructionHelper<1, 1, 1> michael@0: { michael@0: public: michael@0: LIR_HEADER(AsmJSLoadFuncPtr); michael@0: LAsmJSLoadFuncPtr(const LAllocation &index, const LDefinition &temp) { michael@0: setOperand(0, index); michael@0: setTemp(0, temp); michael@0: } michael@0: MAsmJSLoadFuncPtr *mir() const { michael@0: return mir_->toAsmJSLoadFuncPtr(); michael@0: } michael@0: const LAllocation *index() { michael@0: return getOperand(0); michael@0: } michael@0: const LDefinition *temp() { michael@0: return getTemp(0); michael@0: } michael@0: }; michael@0: michael@0: } // namespace jit michael@0: } // namespace js michael@0: michael@0: #endif /* jit_x64_LIR_x64_h */