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_LIR_x86_h michael@0: #define jit_x86_LIR_x86_h michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: class LBox : public LInstructionHelper<2, 1, 0> michael@0: { michael@0: MIRType type_; michael@0: michael@0: public: michael@0: LIR_HEADER(Box); michael@0: michael@0: LBox(const LAllocation &in_payload, MIRType type) michael@0: : type_(type) michael@0: { michael@0: setOperand(0, in_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: class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1> michael@0: { michael@0: MIRType type_; michael@0: michael@0: public: michael@0: LIR_HEADER(BoxFloatingPoint); michael@0: michael@0: LBoxFloatingPoint(const LAllocation &in, const LDefinition &temp, MIRType type) michael@0: : type_(type) michael@0: { michael@0: JS_ASSERT(IsFloatingPointType(type)); michael@0: setOperand(0, in); michael@0: setTemp(0, temp); 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: class LUnbox : public LInstructionHelper<1, 2, 0> michael@0: { michael@0: public: michael@0: LIR_HEADER(Unbox); michael@0: michael@0: MUnbox *mir() const { michael@0: return mir_->toUnbox(); michael@0: } michael@0: const LAllocation *payload() { michael@0: return getOperand(0); michael@0: } michael@0: const LAllocation *type() { michael@0: return getOperand(1); 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 LInstructionHelper<1, 2, 0> michael@0: { michael@0: MIRType type_; michael@0: michael@0: public: michael@0: LIR_HEADER(UnboxFloatingPoint); michael@0: michael@0: static const size_t Input = 0; michael@0: michael@0: LUnboxFloatingPoint(MIRType type) michael@0: : type_(type) michael@0: { } michael@0: michael@0: MUnbox *mir() const { michael@0: return mir_->toUnbox(); 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, 1> michael@0: { michael@0: public: michael@0: LIR_HEADER(AsmJSUInt32ToDouble) michael@0: michael@0: LAsmJSUInt32ToDouble(const LAllocation &input, const LDefinition &temp) { michael@0: setOperand(0, input); michael@0: setTemp(0, temp); michael@0: } michael@0: const LDefinition *temp() { michael@0: return getTemp(0); 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, 1> michael@0: { michael@0: public: michael@0: LIR_HEADER(AsmJSUInt32ToFloat32) michael@0: michael@0: LAsmJSUInt32ToFloat32(const LAllocation &input, const LDefinition &temp) { michael@0: setOperand(0, input); michael@0: setTemp(0, temp); michael@0: } michael@0: const LDefinition *temp() { michael@0: return getTemp(0); michael@0: } michael@0: }; michael@0: michael@0: class LAsmJSLoadFuncPtr : public LInstructionHelper<1, 1, 0> michael@0: { michael@0: public: michael@0: LIR_HEADER(AsmJSLoadFuncPtr); michael@0: LAsmJSLoadFuncPtr(const LAllocation &index) { michael@0: setOperand(0, index); 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: }; michael@0: michael@0: } // namespace jit michael@0: } // namespace js michael@0: michael@0: #endif /* jit_x86_LIR_x86_h */