js/src/jit/mips/LIR-mips.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit/mips/LIR-mips.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,404 @@
     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_mips_LIR_mips_h
    1.11 +#define jit_mips_LIR_mips_h
    1.12 +
    1.13 +namespace js {
    1.14 +namespace jit {
    1.15 +
    1.16 +class LBox : public LInstructionHelper<2, 1, 0>
    1.17 +{
    1.18 +    MIRType type_;
    1.19 +
    1.20 +  public:
    1.21 +    LIR_HEADER(Box);
    1.22 +
    1.23 +    LBox(const LAllocation &in_payload, MIRType type)
    1.24 +      : type_(type)
    1.25 +    {
    1.26 +        setOperand(0, in_payload);
    1.27 +    }
    1.28 +
    1.29 +    MIRType type() const {
    1.30 +        return type_;
    1.31 +    }
    1.32 +    const char *extraName() const {
    1.33 +        return StringFromMIRType(type_);
    1.34 +    }
    1.35 +};
    1.36 +
    1.37 +class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1>
    1.38 +{
    1.39 +    MIRType type_;
    1.40 +
    1.41 +  public:
    1.42 +    LIR_HEADER(BoxFloatingPoint);
    1.43 +
    1.44 +    LBoxFloatingPoint(const LAllocation &in, const LDefinition &temp, MIRType type)
    1.45 +      : type_(type)
    1.46 +    {
    1.47 +        setOperand(0, in);
    1.48 +        setTemp(0, temp);
    1.49 +    }
    1.50 +
    1.51 +    MIRType type() const {
    1.52 +        return type_;
    1.53 +    }
    1.54 +    const char *extraName() const {
    1.55 +        return StringFromMIRType(type_);
    1.56 +    }
    1.57 +};
    1.58 +
    1.59 +class LUnbox : public LInstructionHelper<1, 2, 0>
    1.60 +{
    1.61 +  public:
    1.62 +    LIR_HEADER(Unbox);
    1.63 +
    1.64 +    MUnbox *mir() const {
    1.65 +        return mir_->toUnbox();
    1.66 +    }
    1.67 +    const LAllocation *payload() {
    1.68 +        return getOperand(0);
    1.69 +    }
    1.70 +    const LAllocation *type() {
    1.71 +        return getOperand(1);
    1.72 +    }
    1.73 +    const char *extraName() const {
    1.74 +        return StringFromMIRType(mir()->type());
    1.75 +    }
    1.76 +};
    1.77 +
    1.78 +class LUnboxFloatingPoint : public LInstructionHelper<1, 2, 0>
    1.79 +{
    1.80 +    MIRType type_;
    1.81 +
    1.82 +  public:
    1.83 +    LIR_HEADER(UnboxFloatingPoint);
    1.84 +
    1.85 +    static const size_t Input = 0;
    1.86 +
    1.87 +    LUnboxFloatingPoint(MIRType type)
    1.88 +      : type_(type)
    1.89 +    { }
    1.90 +
    1.91 +    MUnbox *mir() const {
    1.92 +        return mir_->toUnbox();
    1.93 +    }
    1.94 +
    1.95 +    MIRType type() const {
    1.96 +        return type_;
    1.97 +    }
    1.98 +    const char *extraName() const {
    1.99 +        return StringFromMIRType(type_);
   1.100 +    }
   1.101 +};
   1.102 +
   1.103 +// Convert a 32-bit unsigned integer to a double.
   1.104 +class LAsmJSUInt32ToDouble : public LInstructionHelper<1, 1, 0>
   1.105 +{
   1.106 +  public:
   1.107 +    LIR_HEADER(AsmJSUInt32ToDouble)
   1.108 +
   1.109 +    LAsmJSUInt32ToDouble(const LAllocation &input) {
   1.110 +        setOperand(0, input);
   1.111 +    }
   1.112 +};
   1.113 +
   1.114 +// Convert a 32-bit unsigned integer to a float32.
   1.115 +class LAsmJSUInt32ToFloat32 : public LInstructionHelper<1, 1, 0>
   1.116 +{
   1.117 +  public:
   1.118 +    LIR_HEADER(AsmJSUInt32ToFloat32)
   1.119 +
   1.120 +    LAsmJSUInt32ToFloat32(const LAllocation &input) {
   1.121 +        setOperand(0, input);
   1.122 +    }
   1.123 +};
   1.124 +
   1.125 +
   1.126 +class LDivI : public LBinaryMath<1>
   1.127 +{
   1.128 +  public:
   1.129 +    LIR_HEADER(DivI);
   1.130 +
   1.131 +    LDivI(const LAllocation &lhs, const LAllocation &rhs,
   1.132 +          const LDefinition &temp) {
   1.133 +        setOperand(0, lhs);
   1.134 +        setOperand(1, rhs);
   1.135 +        setTemp(0, temp);
   1.136 +    }
   1.137 +
   1.138 +    MDiv *mir() const {
   1.139 +        return mir_->toDiv();
   1.140 +    }
   1.141 +};
   1.142 +
   1.143 +class LDivPowTwoI : public LInstructionHelper<1, 1, 1>
   1.144 +{
   1.145 +    const int32_t shift_;
   1.146 +
   1.147 +  public:
   1.148 +    LIR_HEADER(DivPowTwoI)
   1.149 +
   1.150 +    LDivPowTwoI(const LAllocation &lhs, int32_t shift, const LDefinition &temp)
   1.151 +      : shift_(shift)
   1.152 +    {
   1.153 +        setOperand(0, lhs);
   1.154 +        setTemp(0, temp);
   1.155 +    }
   1.156 +
   1.157 +    const LAllocation *numerator() {
   1.158 +        return getOperand(0);
   1.159 +    }
   1.160 +
   1.161 +    int32_t shift() {
   1.162 +        return shift_;
   1.163 +    }
   1.164 +
   1.165 +    MDiv *mir() const {
   1.166 +        return mir_->toDiv();
   1.167 +    }
   1.168 +};
   1.169 +
   1.170 +class LModI : public LBinaryMath<1>
   1.171 +{
   1.172 +  public:
   1.173 +    LIR_HEADER(ModI);
   1.174 +
   1.175 +    LModI(const LAllocation &lhs, const LAllocation &rhs,
   1.176 +          const LDefinition &callTemp)
   1.177 +    {
   1.178 +        setOperand(0, lhs);
   1.179 +        setOperand(1, rhs);
   1.180 +        setTemp(0, callTemp);
   1.181 +    }
   1.182 +
   1.183 +    const LDefinition *callTemp() {
   1.184 +        return getTemp(0);
   1.185 +    }
   1.186 +
   1.187 +    MMod *mir() const {
   1.188 +        return mir_->toMod();
   1.189 +    }
   1.190 +};
   1.191 +
   1.192 +class LModPowTwoI : public LInstructionHelper<1, 1, 0>
   1.193 +{
   1.194 +    const int32_t shift_;
   1.195 +
   1.196 +  public:
   1.197 +    LIR_HEADER(ModPowTwoI);
   1.198 +    int32_t shift()
   1.199 +    {
   1.200 +        return shift_;
   1.201 +    }
   1.202 +
   1.203 +    LModPowTwoI(const LAllocation &lhs, int32_t shift)
   1.204 +      : shift_(shift)
   1.205 +    {
   1.206 +        setOperand(0, lhs);
   1.207 +    }
   1.208 +
   1.209 +    MMod *mir() const {
   1.210 +        return mir_->toMod();
   1.211 +    }
   1.212 +};
   1.213 +
   1.214 +class LModMaskI : public LInstructionHelper<1, 1, 1>
   1.215 +{
   1.216 +    const int32_t shift_;
   1.217 +
   1.218 +  public:
   1.219 +    LIR_HEADER(ModMaskI);
   1.220 +
   1.221 +    LModMaskI(const LAllocation &lhs, const LDefinition &temp1, int32_t shift)
   1.222 +      : shift_(shift)
   1.223 +    {
   1.224 +        setOperand(0, lhs);
   1.225 +        setTemp(0, temp1);
   1.226 +    }
   1.227 +
   1.228 +    int32_t shift() const {
   1.229 +        return shift_;
   1.230 +    }
   1.231 +
   1.232 +    MMod *mir() const {
   1.233 +        return mir_->toMod();
   1.234 +    }
   1.235 +};
   1.236 +
   1.237 +class LPowHalfD : public LInstructionHelper<1, 1, 0>
   1.238 +{
   1.239 +  public:
   1.240 +    LIR_HEADER(PowHalfD);
   1.241 +    LPowHalfD(const LAllocation &input) {
   1.242 +        setOperand(0, input);
   1.243 +    }
   1.244 +
   1.245 +    const LAllocation *input() {
   1.246 +        return getOperand(0);
   1.247 +    }
   1.248 +    const LDefinition *output() {
   1.249 +        return getDef(0);
   1.250 +    }
   1.251 +};
   1.252 +
   1.253 +// Takes a tableswitch with an integer to decide
   1.254 +class LTableSwitch : public LInstructionHelper<0, 1, 2>
   1.255 +{
   1.256 +  public:
   1.257 +    LIR_HEADER(TableSwitch);
   1.258 +
   1.259 +    LTableSwitch(const LAllocation &in, const LDefinition &inputCopy,
   1.260 +                 const LDefinition &jumpTablePointer, MTableSwitch *ins) {
   1.261 +        setOperand(0, in);
   1.262 +        setTemp(0, inputCopy);
   1.263 +        setTemp(1, jumpTablePointer);
   1.264 +        setMir(ins);
   1.265 +    }
   1.266 +
   1.267 +    MTableSwitch *mir() const {
   1.268 +        return mir_->toTableSwitch();
   1.269 +    }
   1.270 +
   1.271 +    const LAllocation *index() {
   1.272 +        return getOperand(0);
   1.273 +    }
   1.274 +    const LDefinition *tempInt() {
   1.275 +        return getTemp(0);
   1.276 +    }
   1.277 +    // This is added to share the same CodeGenerator prefixes.
   1.278 +    const LDefinition *tempPointer() {
   1.279 +        return getTemp(1);
   1.280 +    }
   1.281 +};
   1.282 +
   1.283 +// Takes a tableswitch with an integer to decide
   1.284 +class LTableSwitchV : public LInstructionHelper<0, BOX_PIECES, 3>
   1.285 +{
   1.286 +  public:
   1.287 +    LIR_HEADER(TableSwitchV);
   1.288 +
   1.289 +    LTableSwitchV(const LDefinition &inputCopy, const LDefinition &floatCopy,
   1.290 +                  const LDefinition &jumpTablePointer, MTableSwitch *ins)
   1.291 +    {
   1.292 +        setTemp(0, inputCopy);
   1.293 +        setTemp(1, floatCopy);
   1.294 +        setTemp(2, jumpTablePointer);
   1.295 +        setMir(ins);
   1.296 +    }
   1.297 +
   1.298 +    MTableSwitch *mir() const {
   1.299 +        return mir_->toTableSwitch();
   1.300 +    }
   1.301 +
   1.302 +    static const size_t InputValue = 0;
   1.303 +
   1.304 +    const LDefinition *tempInt() {
   1.305 +        return getTemp(0);
   1.306 +    }
   1.307 +    const LDefinition *tempFloat() {
   1.308 +        return getTemp(1);
   1.309 +    }
   1.310 +    const LDefinition *tempPointer() {
   1.311 +        return getTemp(2);
   1.312 +    }
   1.313 +};
   1.314 +
   1.315 +class LGuardShape : public LInstructionHelper<0, 1, 1>
   1.316 +{
   1.317 +  public:
   1.318 +    LIR_HEADER(GuardShape);
   1.319 +
   1.320 +    LGuardShape(const LAllocation &in, const LDefinition &temp) {
   1.321 +        setOperand(0, in);
   1.322 +        setTemp(0, temp);
   1.323 +    }
   1.324 +    const MGuardShape *mir() const {
   1.325 +        return mir_->toGuardShape();
   1.326 +    }
   1.327 +    const LDefinition *tempInt() {
   1.328 +        return getTemp(0);
   1.329 +    }
   1.330 +};
   1.331 +
   1.332 +class LGuardObjectType : public LInstructionHelper<0, 1, 1>
   1.333 +{
   1.334 +  public:
   1.335 +    LIR_HEADER(GuardObjectType);
   1.336 +
   1.337 +    LGuardObjectType(const LAllocation &in, const LDefinition &temp) {
   1.338 +        setOperand(0, in);
   1.339 +        setTemp(0, temp);
   1.340 +    }
   1.341 +    const MGuardObjectType *mir() const {
   1.342 +        return mir_->toGuardObjectType();
   1.343 +    }
   1.344 +    const LDefinition *tempInt() {
   1.345 +        return getTemp(0);
   1.346 +    }
   1.347 +};
   1.348 +
   1.349 +class LInterruptCheck : public LInstructionHelper<0, 0, 0>
   1.350 +{
   1.351 +  public:
   1.352 +    LIR_HEADER(InterruptCheck);
   1.353 +};
   1.354 +
   1.355 +class LMulI : public LBinaryMath<0>
   1.356 +{
   1.357 +  public:
   1.358 +    LIR_HEADER(MulI);
   1.359 +
   1.360 +    MMul *mir() {
   1.361 +        return mir_->toMul();
   1.362 +    }
   1.363 +};
   1.364 +
   1.365 +class LUDiv : public LBinaryMath<0>
   1.366 +{
   1.367 +  public:
   1.368 +    LIR_HEADER(UDiv);
   1.369 +
   1.370 +    MDiv *mir() {
   1.371 +        return mir_->toDiv();
   1.372 +    }
   1.373 +};
   1.374 +
   1.375 +class LUMod : public LBinaryMath<0>
   1.376 +{
   1.377 +  public:
   1.378 +    LIR_HEADER(UMod);
   1.379 +
   1.380 +    MMod *mir() {
   1.381 +        return mir_->toMod();
   1.382 +    }
   1.383 +};
   1.384 +
   1.385 +class LAsmJSLoadFuncPtr : public LInstructionHelper<1, 1, 1>
   1.386 +{
   1.387 +  public:
   1.388 +    LIR_HEADER(AsmJSLoadFuncPtr);
   1.389 +    LAsmJSLoadFuncPtr(const LAllocation &index, const LDefinition &temp) {
   1.390 +        setOperand(0, index);
   1.391 +        setTemp(0, temp);
   1.392 +    }
   1.393 +    const MAsmJSLoadFuncPtr *mir() const {
   1.394 +        return mir_->toAsmJSLoadFuncPtr();
   1.395 +    }
   1.396 +    const LAllocation *index() {
   1.397 +        return getOperand(0);
   1.398 +    }
   1.399 +    const LDefinition *temp() {
   1.400 +        return getTemp(0);
   1.401 +    }
   1.402 +};
   1.403 +
   1.404 +} // namespace jit
   1.405 +} // namespace js
   1.406 +
   1.407 +#endif /* jit_mips_LIR_mips_h */

mercurial