js/src/jit/arm/Lowering-arm.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit/arm/Lowering-arm.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,105 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef jit_arm_Lowering_arm_h
    1.11 +#define jit_arm_Lowering_arm_h
    1.12 +
    1.13 +#include "jit/shared/Lowering-shared.h"
    1.14 +
    1.15 +namespace js {
    1.16 +namespace jit {
    1.17 +
    1.18 +class LIRGeneratorARM : public LIRGeneratorShared
    1.19 +{
    1.20 +  public:
    1.21 +    LIRGeneratorARM(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph)
    1.22 +      : LIRGeneratorShared(gen, graph, lirGraph)
    1.23 +    { }
    1.24 +
    1.25 +  protected:
    1.26 +    // Adds a box input to an instruction, setting operand |n| to the type and
    1.27 +    // |n+1| to the payload.
    1.28 +    bool useBox(LInstruction *lir, size_t n, MDefinition *mir,
    1.29 +                LUse::Policy policy = LUse::REGISTER, bool useAtStart = false);
    1.30 +    bool useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2);
    1.31 +
    1.32 +    // x86 has constraints on what registers can be formatted for 1-byte
    1.33 +    // stores and loads; on ARM all registers are okay.
    1.34 +    LAllocation useByteOpRegister(MDefinition *mir);
    1.35 +    LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition *mir);
    1.36 +
    1.37 +    inline LDefinition tempToUnbox() {
    1.38 +        return LDefinition::BogusTemp();
    1.39 +    }
    1.40 +
    1.41 +    bool needTempForPostBarrier() { return false; }
    1.42 +
    1.43 +    // x64 has a scratch register, so no need for another temp for dispatch
    1.44 +    // ICs.
    1.45 +    LDefinition tempForDispatchCache(MIRType outputType = MIRType_None) {
    1.46 +        return LDefinition::BogusTemp();
    1.47 +    }
    1.48 +
    1.49 +    void lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock *block, size_t lirIndex);
    1.50 +    bool defineUntypedPhi(MPhi *phi, size_t lirIndex);
    1.51 +    bool lowerForShift(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir, MDefinition *lhs,
    1.52 +                       MDefinition *rhs);
    1.53 +    bool lowerUrshD(MUrsh *mir);
    1.54 +
    1.55 +    bool lowerForALU(LInstructionHelper<1, 1, 0> *ins, MDefinition *mir,
    1.56 +                     MDefinition *input);
    1.57 +    bool lowerForALU(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir,
    1.58 +                     MDefinition *lhs, MDefinition *rhs);
    1.59 +
    1.60 +    bool lowerForFPU(LInstructionHelper<1, 1, 0> *ins, MDefinition *mir,
    1.61 +                     MDefinition *src);
    1.62 +    bool lowerForFPU(LInstructionHelper<1, 2, 0> *ins, MDefinition *mir,
    1.63 +                     MDefinition *lhs, MDefinition *rhs);
    1.64 +    bool lowerForBitAndAndBranch(LBitAndAndBranch *baab, MInstruction *mir,
    1.65 +                                 MDefinition *lhs, MDefinition *rhs);
    1.66 +    bool lowerConstantDouble(double d, MInstruction *ins);
    1.67 +    bool lowerConstantFloat32(float d, MInstruction *ins);
    1.68 +    bool lowerTruncateDToInt32(MTruncateToInt32 *ins);
    1.69 +    bool lowerTruncateFToInt32(MTruncateToInt32 *ins);
    1.70 +    bool lowerDivI(MDiv *div);
    1.71 +    bool lowerModI(MMod *mod);
    1.72 +    bool lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs);
    1.73 +    bool lowerUDiv(MDiv *div);
    1.74 +    bool lowerUMod(MMod *mod);
    1.75 +    bool visitPowHalf(MPowHalf *ins);
    1.76 +    bool visitAsmJSNeg(MAsmJSNeg *ins);
    1.77 +
    1.78 +    LTableSwitch *newLTableSwitch(const LAllocation &in, const LDefinition &inputCopy,
    1.79 +                                  MTableSwitch *ins);
    1.80 +    LTableSwitchV *newLTableSwitchV(MTableSwitch *ins);
    1.81 +
    1.82 +  public:
    1.83 +    bool visitConstant(MConstant *ins);
    1.84 +    bool visitBox(MBox *box);
    1.85 +    bool visitUnbox(MUnbox *unbox);
    1.86 +    bool visitReturn(MReturn *ret);
    1.87 +    bool lowerPhi(MPhi *phi);
    1.88 +    bool visitGuardShape(MGuardShape *ins);
    1.89 +    bool visitGuardObjectType(MGuardObjectType *ins);
    1.90 +    bool visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins);
    1.91 +    bool visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins);
    1.92 +    bool visitAsmJSLoadHeap(MAsmJSLoadHeap *ins);
    1.93 +    bool visitAsmJSStoreHeap(MAsmJSStoreHeap *ins);
    1.94 +    bool visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr *ins);
    1.95 +    bool visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic *ins);
    1.96 +    bool visitForkJoinGetSlice(MForkJoinGetSlice *ins);
    1.97 +
    1.98 +    static bool allowFloat32Optimizations() {
    1.99 +        return true;
   1.100 +    }
   1.101 +};
   1.102 +
   1.103 +typedef LIRGeneratorARM LIRGeneratorSpecific;
   1.104 +
   1.105 +} // namespace jit
   1.106 +} // namespace js
   1.107 +
   1.108 +#endif /* jit_arm_Lowering_arm_h */

mercurial