LCOV - code coverage report
Current view: top level - src/compiler - machine-operator.h (source / functions) Hit Total Coverage
Test: app.info Lines: 12 15 80.0 %
Date: 2017-04-26 Functions: 12 14 85.7 %

          Line data    Source code
       1             : // Copyright 2013 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_COMPILER_MACHINE_OPERATOR_H_
       6             : #define V8_COMPILER_MACHINE_OPERATOR_H_
       7             : 
       8             : #include "src/base/compiler-specific.h"
       9             : #include "src/base/flags.h"
      10             : #include "src/globals.h"
      11             : #include "src/machine-type.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : namespace compiler {
      16             : 
      17             : // Forward declarations.
      18             : struct MachineOperatorGlobalCache;
      19             : class Operator;
      20             : 
      21             : 
      22             : // For operators that are not supported on all platforms.
      23             : class OptionalOperator final {
      24             :  public:
      25             :   OptionalOperator(bool supported, const Operator* op)
      26       49152 :       : supported_(supported), op_(op) {}
      27             : 
      28             :   bool IsSupported() const { return supported_; }
      29             :   // Gets the operator only if it is supported.
      30             :   const Operator* op() const {
      31             :     DCHECK(supported_);
      32             :     return op_;
      33             :   }
      34             :   // Always gets the operator, even for unsupported operators. This is useful to
      35             :   // use the operator as a placeholder in a graph, for instance.
      36             :   const Operator* placeholder() const { return op_; }
      37             : 
      38             :  private:
      39             :   bool supported_;
      40             :   const Operator* const op_;
      41             : };
      42             : 
      43             : 
      44             : // A Load needs a MachineType.
      45             : typedef MachineType LoadRepresentation;
      46             : 
      47             : LoadRepresentation LoadRepresentationOf(Operator const*);
      48             : 
      49             : // A Store needs a MachineType and a WriteBarrierKind in order to emit the
      50             : // correct write barrier.
      51             : class StoreRepresentation final {
      52             :  public:
      53             :   StoreRepresentation(MachineRepresentation representation,
      54             :                       WriteBarrierKind write_barrier_kind)
      55             :       : representation_(representation),
      56     2135933 :         write_barrier_kind_(write_barrier_kind) {}
      57             : 
      58             :   MachineRepresentation representation() const { return representation_; }
      59             :   WriteBarrierKind write_barrier_kind() const { return write_barrier_kind_; }
      60             : 
      61             :  private:
      62             :   MachineRepresentation representation_;
      63             :   WriteBarrierKind write_barrier_kind_;
      64             : };
      65             : 
      66             : V8_EXPORT_PRIVATE bool operator==(StoreRepresentation, StoreRepresentation);
      67             : bool operator!=(StoreRepresentation, StoreRepresentation);
      68             : 
      69             : size_t hash_value(StoreRepresentation);
      70             : 
      71             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, StoreRepresentation);
      72             : 
      73             : StoreRepresentation const& StoreRepresentationOf(Operator const*);
      74             : 
      75             : typedef MachineType UnalignedLoadRepresentation;
      76             : 
      77             : UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const*);
      78             : 
      79             : // An UnalignedStore needs a MachineType.
      80             : typedef MachineRepresentation UnalignedStoreRepresentation;
      81             : 
      82             : UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
      83             :     Operator const*);
      84             : 
      85             : // A CheckedLoad needs a MachineType.
      86             : typedef MachineType CheckedLoadRepresentation;
      87             : 
      88             : CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const*);
      89             : 
      90             : 
      91             : // A CheckedStore needs a MachineType.
      92             : typedef MachineRepresentation CheckedStoreRepresentation;
      93             : 
      94             : CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const*);
      95             : 
      96             : int StackSlotSizeOf(Operator const* op);
      97             : 
      98             : MachineRepresentation AtomicStoreRepresentationOf(Operator const* op);
      99             : 
     100             : MachineType AtomicOpRepresentationOf(Operator const* op);
     101             : 
     102             : // Interface for building machine-level operators. These operators are
     103             : // machine-level but machine-independent and thus define a language suitable
     104             : // for generating code to run on architectures such as ia32, x64, arm, etc.
     105             : class V8_EXPORT_PRIVATE MachineOperatorBuilder final
     106             :     : public NON_EXPORTED_BASE(ZoneObject) {
     107             :  public:
     108             :   // Flags that specify which operations are available. This is useful
     109             :   // for operations that are unsupported by some back-ends.
     110             :   enum Flag : unsigned {
     111             :     kNoFlags = 0u,
     112             :     kFloat32RoundDown = 1u << 0,
     113             :     kFloat64RoundDown = 1u << 1,
     114             :     kFloat32RoundUp = 1u << 2,
     115             :     kFloat64RoundUp = 1u << 3,
     116             :     kFloat32RoundTruncate = 1u << 4,
     117             :     kFloat64RoundTruncate = 1u << 5,
     118             :     kFloat32RoundTiesEven = 1u << 6,
     119             :     kFloat64RoundTiesEven = 1u << 7,
     120             :     kFloat64RoundTiesAway = 1u << 8,
     121             :     kInt32DivIsSafe = 1u << 9,
     122             :     kUint32DivIsSafe = 1u << 10,
     123             :     kWord32ShiftIsSafe = 1u << 11,
     124             :     kWord32Ctz = 1u << 12,
     125             :     kWord64Ctz = 1u << 13,
     126             :     kWord32Popcnt = 1u << 14,
     127             :     kWord64Popcnt = 1u << 15,
     128             :     kWord32ReverseBits = 1u << 16,
     129             :     kWord64ReverseBits = 1u << 17,
     130             :     kWord32ReverseBytes = 1u << 18,
     131             :     kWord64ReverseBytes = 1u << 19,
     132             :     kInt32AbsWithOverflow = 1u << 20,
     133             :     kInt64AbsWithOverflow = 1u << 21,
     134             :     kAllOptionalOps =
     135             :         kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp |
     136             :         kFloat64RoundUp | kFloat32RoundTruncate | kFloat64RoundTruncate |
     137             :         kFloat64RoundTiesAway | kFloat32RoundTiesEven | kFloat64RoundTiesEven |
     138             :         kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt |
     139             :         kWord32ReverseBits | kWord64ReverseBits | kWord32ReverseBytes |
     140             :         kWord64ReverseBytes | kInt32AbsWithOverflow | kInt64AbsWithOverflow
     141             :   };
     142             :   typedef base::Flags<Flag, unsigned> Flags;
     143             : 
     144             :   class AlignmentRequirements {
     145             :    public:
     146             :     enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport };
     147             : 
     148             :     bool IsUnalignedLoadSupported(const MachineType& machineType,
     149       10788 :                                   uint8_t alignment) const {
     150             :       return IsUnalignedSupported(unalignedLoadUnsupportedTypes_, machineType,
     151       21576 :                                   alignment);
     152             :     }
     153             : 
     154             :     bool IsUnalignedStoreSupported(const MachineType& machineType,
     155        1611 :                                    uint8_t alignment) const {
     156             :       return IsUnalignedSupported(unalignedStoreUnsupportedTypes_, machineType,
     157        3222 :                                   alignment);
     158             :     }
     159             : 
     160             :     static AlignmentRequirements FullUnalignedAccessSupport() {
     161             :       return AlignmentRequirements(kFullSupport);
     162             :     }
     163             :     static AlignmentRequirements NoUnalignedAccessSupport() {
     164             :       return AlignmentRequirements(kNoSupport);
     165             :     }
     166             :     static AlignmentRequirements SomeUnalignedAccessUnsupported(
     167             :         const Vector<MachineType>& unalignedLoadUnsupportedTypes,
     168             :         const Vector<MachineType>& unalignedStoreUnsupportedTypes) {
     169             :       return AlignmentRequirements(kSomeSupport, unalignedLoadUnsupportedTypes,
     170             :                                    unalignedStoreUnsupportedTypes);
     171             :     }
     172             : 
     173             :    private:
     174             :     explicit AlignmentRequirements(
     175             :         AlignmentRequirements::UnalignedAccessSupport unalignedAccessSupport,
     176             :         Vector<MachineType> unalignedLoadUnsupportedTypes =
     177             :             Vector<MachineType>(NULL, 0),
     178             :         Vector<MachineType> unalignedStoreUnsupportedTypes =
     179             :             Vector<MachineType>(NULL, 0))
     180             :         : unalignedSupport_(unalignedAccessSupport),
     181             :           unalignedLoadUnsupportedTypes_(unalignedLoadUnsupportedTypes),
     182      964287 :           unalignedStoreUnsupportedTypes_(unalignedStoreUnsupportedTypes) {}
     183             : 
     184       12400 :     bool IsUnalignedSupported(const Vector<MachineType>& unsupported,
     185             :                               const MachineType& machineType,
     186             :                               uint8_t alignment) const {
     187             :       // All accesses of bytes in memory are aligned.
     188             :       DCHECK_NE(machineType.representation(), MachineRepresentation::kWord8);
     189       12400 :       if (unalignedSupport_ == kFullSupport) {
     190             :         return true;
     191           0 :       } else if (unalignedSupport_ == kNoSupport) {
     192             :         return false;
     193             :       } else {
     194           0 :         for (MachineType m : unsupported) {
     195           0 :           if (m == machineType) {
     196             :             return false;
     197             :           }
     198             :         }
     199             :         return true;
     200             :       }
     201             :     }
     202             : 
     203             :     const AlignmentRequirements::UnalignedAccessSupport unalignedSupport_;
     204             :     const Vector<MachineType> unalignedLoadUnsupportedTypes_;
     205             :     const Vector<MachineType> unalignedStoreUnsupportedTypes_;
     206             :   };
     207             : 
     208             :   explicit MachineOperatorBuilder(
     209             :       Zone* zone,
     210             :       MachineRepresentation word = MachineType::PointerRepresentation(),
     211             :       Flags supportedOperators = kNoFlags,
     212             :       AlignmentRequirements alignmentRequirements =
     213             :           AlignmentRequirements::FullUnalignedAccessSupport());
     214             : 
     215             :   const Operator* Comment(const char* msg);
     216             :   const Operator* DebugBreak();
     217             :   const Operator* UnsafePointerAdd();
     218             : 
     219             :   const Operator* Word32And();
     220             :   const Operator* Word32Or();
     221             :   const Operator* Word32Xor();
     222             :   const Operator* Word32Shl();
     223             :   const Operator* Word32Shr();
     224             :   const Operator* Word32Sar();
     225             :   const Operator* Word32Ror();
     226             :   const Operator* Word32Equal();
     227             :   const Operator* Word32Clz();
     228             :   const OptionalOperator Word32Ctz();
     229             :   const OptionalOperator Word32Popcnt();
     230             :   const OptionalOperator Word64Popcnt();
     231             :   const OptionalOperator Word32ReverseBits();
     232             :   const OptionalOperator Word64ReverseBits();
     233             :   const OptionalOperator Word32ReverseBytes();
     234             :   const OptionalOperator Word64ReverseBytes();
     235             :   const OptionalOperator Int32AbsWithOverflow();
     236             :   const OptionalOperator Int64AbsWithOverflow();
     237             :   bool Word32ShiftIsSafe() const { return flags_ & kWord32ShiftIsSafe; }
     238             : 
     239             :   const Operator* Word64And();
     240             :   const Operator* Word64Or();
     241             :   const Operator* Word64Xor();
     242             :   const Operator* Word64Shl();
     243             :   const Operator* Word64Shr();
     244             :   const Operator* Word64Sar();
     245             :   const Operator* Word64Ror();
     246             :   const Operator* Word64Clz();
     247             :   const OptionalOperator Word64Ctz();
     248             :   const Operator* Word64Equal();
     249             : 
     250             :   const Operator* Int32PairAdd();
     251             :   const Operator* Int32PairSub();
     252             :   const Operator* Int32PairMul();
     253             :   const Operator* Word32PairShl();
     254             :   const Operator* Word32PairShr();
     255             :   const Operator* Word32PairSar();
     256             : 
     257             :   const Operator* Int32Add();
     258             :   const Operator* Int32AddWithOverflow();
     259             :   const Operator* Int32Sub();
     260             :   const Operator* Int32SubWithOverflow();
     261             :   const Operator* Int32Mul();
     262             :   const Operator* Int32MulWithOverflow();
     263             :   const Operator* Int32MulHigh();
     264             :   const Operator* Int32Div();
     265             :   const Operator* Int32Mod();
     266             :   const Operator* Int32LessThan();
     267             :   const Operator* Int32LessThanOrEqual();
     268             :   const Operator* Uint32Div();
     269             :   const Operator* Uint32LessThan();
     270             :   const Operator* Uint32LessThanOrEqual();
     271             :   const Operator* Uint32Mod();
     272             :   const Operator* Uint32MulHigh();
     273             :   bool Int32DivIsSafe() const { return flags_ & kInt32DivIsSafe; }
     274             :   bool Uint32DivIsSafe() const { return flags_ & kUint32DivIsSafe; }
     275             : 
     276             :   const Operator* Int64Add();
     277             :   const Operator* Int64AddWithOverflow();
     278             :   const Operator* Int64Sub();
     279             :   const Operator* Int64SubWithOverflow();
     280             :   const Operator* Int64Mul();
     281             :   const Operator* Int64Div();
     282             :   const Operator* Int64Mod();
     283             :   const Operator* Int64LessThan();
     284             :   const Operator* Int64LessThanOrEqual();
     285             :   const Operator* Uint64Div();
     286             :   const Operator* Uint64LessThan();
     287             :   const Operator* Uint64LessThanOrEqual();
     288             :   const Operator* Uint64Mod();
     289             : 
     290             :   // This operator reinterprets the bits of a tagged pointer as word.
     291             :   const Operator* BitcastTaggedToWord();
     292             : 
     293             :   // This operator reinterprets the bits of a word as tagged pointer.
     294             :   const Operator* BitcastWordToTagged();
     295             : 
     296             :   // This operator reinterprets the bits of a word as a Smi.
     297             :   const Operator* BitcastWordToTaggedSigned();
     298             : 
     299             :   // JavaScript float64 to int32/uint32 truncation.
     300             :   const Operator* TruncateFloat64ToWord32();
     301             : 
     302             :   // These operators change the representation of numbers while preserving the
     303             :   // value of the number. Narrowing operators assume the input is representable
     304             :   // in the target type and are *not* defined for other inputs.
     305             :   // Use narrowing change operators only when there is a static guarantee that
     306             :   // the input value is representable in the target value.
     307             :   const Operator* ChangeFloat32ToFloat64();
     308             :   const Operator* ChangeFloat64ToInt32();   // narrowing
     309             :   const Operator* ChangeFloat64ToUint32();  // narrowing
     310             :   const Operator* ChangeFloat64ToUint64();
     311             :   const Operator* TruncateFloat64ToUint32();
     312             :   const Operator* TruncateFloat32ToInt32();
     313             :   const Operator* TruncateFloat32ToUint32();
     314             :   const Operator* TryTruncateFloat32ToInt64();
     315             :   const Operator* TryTruncateFloat64ToInt64();
     316             :   const Operator* TryTruncateFloat32ToUint64();
     317             :   const Operator* TryTruncateFloat64ToUint64();
     318             :   const Operator* ChangeInt32ToFloat64();
     319             :   const Operator* ChangeInt32ToInt64();
     320             :   const Operator* ChangeUint32ToFloat64();
     321             :   const Operator* ChangeUint32ToUint64();
     322             : 
     323             :   // These operators truncate or round numbers, both changing the representation
     324             :   // of the number and mapping multiple input values onto the same output value.
     325             :   const Operator* TruncateFloat64ToFloat32();
     326             :   const Operator* TruncateInt64ToInt32();
     327             :   const Operator* RoundFloat64ToInt32();
     328             :   const Operator* RoundInt32ToFloat32();
     329             :   const Operator* RoundInt64ToFloat32();
     330             :   const Operator* RoundInt64ToFloat64();
     331             :   const Operator* RoundUint32ToFloat32();
     332             :   const Operator* RoundUint64ToFloat32();
     333             :   const Operator* RoundUint64ToFloat64();
     334             : 
     335             :   // These operators reinterpret the bits of a floating point number as an
     336             :   // integer and vice versa.
     337             :   const Operator* BitcastFloat32ToInt32();
     338             :   const Operator* BitcastFloat64ToInt64();
     339             :   const Operator* BitcastInt32ToFloat32();
     340             :   const Operator* BitcastInt64ToFloat64();
     341             : 
     342             :   // Floating point operators always operate with IEEE 754 round-to-nearest
     343             :   // (single-precision).
     344             :   const Operator* Float32Add();
     345             :   const Operator* Float32Sub();
     346             :   const Operator* Float32Mul();
     347             :   const Operator* Float32Div();
     348             :   const Operator* Float32Sqrt();
     349             : 
     350             :   // Floating point operators always operate with IEEE 754 round-to-nearest
     351             :   // (double-precision).
     352             :   const Operator* Float64Add();
     353             :   const Operator* Float64Sub();
     354             :   const Operator* Float64Mul();
     355             :   const Operator* Float64Div();
     356             :   const Operator* Float64Mod();
     357             :   const Operator* Float64Sqrt();
     358             : 
     359             :   // Floating point comparisons complying to IEEE 754 (single-precision).
     360             :   const Operator* Float32Equal();
     361             :   const Operator* Float32LessThan();
     362             :   const Operator* Float32LessThanOrEqual();
     363             : 
     364             :   // Floating point comparisons complying to IEEE 754 (double-precision).
     365             :   const Operator* Float64Equal();
     366             :   const Operator* Float64LessThan();
     367             :   const Operator* Float64LessThanOrEqual();
     368             : 
     369             :   // Floating point min/max complying to EcmaScript 6 (double-precision).
     370             :   const Operator* Float64Max();
     371             :   const Operator* Float64Min();
     372             :   // Floating point min/max complying to WebAssembly (single-precision).
     373             :   const Operator* Float32Max();
     374             :   const Operator* Float32Min();
     375             : 
     376             :   // Floating point abs complying to IEEE 754 (single-precision).
     377             :   const Operator* Float32Abs();
     378             : 
     379             :   // Floating point abs complying to IEEE 754 (double-precision).
     380             :   const Operator* Float64Abs();
     381             : 
     382             :   // Floating point rounding.
     383             :   const OptionalOperator Float32RoundDown();
     384             :   const OptionalOperator Float64RoundDown();
     385             :   const OptionalOperator Float32RoundUp();
     386             :   const OptionalOperator Float64RoundUp();
     387             :   const OptionalOperator Float32RoundTruncate();
     388             :   const OptionalOperator Float64RoundTruncate();
     389             :   const OptionalOperator Float64RoundTiesAway();
     390             :   const OptionalOperator Float32RoundTiesEven();
     391             :   const OptionalOperator Float64RoundTiesEven();
     392             : 
     393             :   // Floating point neg.
     394             :   const Operator* Float32Neg();
     395             :   const Operator* Float64Neg();
     396             : 
     397             :   // Floating point trigonometric functions (double-precision).
     398             :   const Operator* Float64Acos();
     399             :   const Operator* Float64Acosh();
     400             :   const Operator* Float64Asin();
     401             :   const Operator* Float64Asinh();
     402             :   const Operator* Float64Atan();
     403             :   const Operator* Float64Atan2();
     404             :   const Operator* Float64Atanh();
     405             :   const Operator* Float64Cos();
     406             :   const Operator* Float64Cosh();
     407             :   const Operator* Float64Sin();
     408             :   const Operator* Float64Sinh();
     409             :   const Operator* Float64Tan();
     410             :   const Operator* Float64Tanh();
     411             : 
     412             :   // Floating point exponential functions (double-precision).
     413             :   const Operator* Float64Exp();
     414             :   const Operator* Float64Expm1();
     415             :   const Operator* Float64Pow();
     416             : 
     417             :   // Floating point logarithm (double-precision).
     418             :   const Operator* Float64Log();
     419             :   const Operator* Float64Log1p();
     420             :   const Operator* Float64Log2();
     421             :   const Operator* Float64Log10();
     422             : 
     423             :   // Floating point cube root (double-precision).
     424             :   const Operator* Float64Cbrt();
     425             : 
     426             :   // Floating point bit representation.
     427             :   const Operator* Float64ExtractLowWord32();
     428             :   const Operator* Float64ExtractHighWord32();
     429             :   const Operator* Float64InsertLowWord32();
     430             :   const Operator* Float64InsertHighWord32();
     431             : 
     432             :   // Change signalling NaN to quiet NaN.
     433             :   // Identity for any input that is not signalling NaN.
     434             :   const Operator* Float64SilenceNaN();
     435             : 
     436             :   // SIMD operators.
     437             :   const Operator* F32x4Splat();
     438             :   const Operator* F32x4ExtractLane(int32_t);
     439             :   const Operator* F32x4ReplaceLane(int32_t);
     440             :   const Operator* F32x4SConvertI32x4();
     441             :   const Operator* F32x4UConvertI32x4();
     442             :   const Operator* F32x4Abs();
     443             :   const Operator* F32x4Neg();
     444             :   const Operator* F32x4RecipApprox();
     445             :   const Operator* F32x4RecipSqrtApprox();
     446             :   const Operator* F32x4Add();
     447             :   const Operator* F32x4AddHoriz();
     448             :   const Operator* F32x4Sub();
     449             :   const Operator* F32x4Mul();
     450             :   const Operator* F32x4Div();
     451             :   const Operator* F32x4Min();
     452             :   const Operator* F32x4Max();
     453             :   const Operator* F32x4Eq();
     454             :   const Operator* F32x4Ne();
     455             :   const Operator* F32x4Lt();
     456             :   const Operator* F32x4Le();
     457             : 
     458             :   const Operator* I32x4Splat();
     459             :   const Operator* I32x4ExtractLane(int32_t);
     460             :   const Operator* I32x4ReplaceLane(int32_t);
     461             :   const Operator* I32x4SConvertF32x4();
     462             :   const Operator* I32x4SConvertI16x8Low();
     463             :   const Operator* I32x4SConvertI16x8High();
     464             :   const Operator* I32x4Neg();
     465             :   const Operator* I32x4Shl(int32_t);
     466             :   const Operator* I32x4ShrS(int32_t);
     467             :   const Operator* I32x4Add();
     468             :   const Operator* I32x4AddHoriz();
     469             :   const Operator* I32x4Sub();
     470             :   const Operator* I32x4Mul();
     471             :   const Operator* I32x4MinS();
     472             :   const Operator* I32x4MaxS();
     473             :   const Operator* I32x4Eq();
     474             :   const Operator* I32x4Ne();
     475             :   const Operator* I32x4LtS();
     476             :   const Operator* I32x4LeS();
     477             : 
     478             :   const Operator* I32x4UConvertF32x4();
     479             :   const Operator* I32x4UConvertI16x8Low();
     480             :   const Operator* I32x4UConvertI16x8High();
     481             :   const Operator* I32x4ShrU(int32_t);
     482             :   const Operator* I32x4MinU();
     483             :   const Operator* I32x4MaxU();
     484             :   const Operator* I32x4LtU();
     485             :   const Operator* I32x4LeU();
     486             : 
     487             :   const Operator* I16x8Splat();
     488             :   const Operator* I16x8ExtractLane(int32_t);
     489             :   const Operator* I16x8ReplaceLane(int32_t);
     490             :   const Operator* I16x8SConvertI8x16Low();
     491             :   const Operator* I16x8SConvertI8x16High();
     492             :   const Operator* I16x8Neg();
     493             :   const Operator* I16x8Shl(int32_t);
     494             :   const Operator* I16x8ShrS(int32_t);
     495             :   const Operator* I16x8SConvertI32x4();
     496             :   const Operator* I16x8Add();
     497             :   const Operator* I16x8AddSaturateS();
     498             :   const Operator* I16x8AddHoriz();
     499             :   const Operator* I16x8Sub();
     500             :   const Operator* I16x8SubSaturateS();
     501             :   const Operator* I16x8Mul();
     502             :   const Operator* I16x8MinS();
     503             :   const Operator* I16x8MaxS();
     504             :   const Operator* I16x8Eq();
     505             :   const Operator* I16x8Ne();
     506             :   const Operator* I16x8LtS();
     507             :   const Operator* I16x8LeS();
     508             : 
     509             :   const Operator* I16x8UConvertI8x16Low();
     510             :   const Operator* I16x8UConvertI8x16High();
     511             :   const Operator* I16x8ShrU(int32_t);
     512             :   const Operator* I16x8UConvertI32x4();
     513             :   const Operator* I16x8AddSaturateU();
     514             :   const Operator* I16x8SubSaturateU();
     515             :   const Operator* I16x8MinU();
     516             :   const Operator* I16x8MaxU();
     517             :   const Operator* I16x8LtU();
     518             :   const Operator* I16x8LeU();
     519             : 
     520             :   const Operator* I8x16Splat();
     521             :   const Operator* I8x16ExtractLane(int32_t);
     522             :   const Operator* I8x16ReplaceLane(int32_t);
     523             :   const Operator* I8x16Neg();
     524             :   const Operator* I8x16Shl(int32_t);
     525             :   const Operator* I8x16ShrS(int32_t);
     526             :   const Operator* I8x16SConvertI16x8();
     527             :   const Operator* I8x16Add();
     528             :   const Operator* I8x16AddSaturateS();
     529             :   const Operator* I8x16Sub();
     530             :   const Operator* I8x16SubSaturateS();
     531             :   const Operator* I8x16Mul();
     532             :   const Operator* I8x16MinS();
     533             :   const Operator* I8x16MaxS();
     534             :   const Operator* I8x16Eq();
     535             :   const Operator* I8x16Ne();
     536             :   const Operator* I8x16LtS();
     537             :   const Operator* I8x16LeS();
     538             : 
     539             :   const Operator* I8x16ShrU(int32_t);
     540             :   const Operator* I8x16UConvertI16x8();
     541             :   const Operator* I8x16AddSaturateU();
     542             :   const Operator* I8x16SubSaturateU();
     543             :   const Operator* I8x16MinU();
     544             :   const Operator* I8x16MaxU();
     545             :   const Operator* I8x16LtU();
     546             :   const Operator* I8x16LeU();
     547             : 
     548             :   const Operator* S128Load();
     549             :   const Operator* S128Store();
     550             : 
     551             :   const Operator* S128Zero();
     552             :   const Operator* S128And();
     553             :   const Operator* S128Or();
     554             :   const Operator* S128Xor();
     555             :   const Operator* S128Not();
     556             : 
     557             :   const Operator* S32x4ZipLeft();
     558             :   const Operator* S32x4ZipRight();
     559             :   const Operator* S32x4UnzipLeft();
     560             :   const Operator* S32x4UnzipRight();
     561             :   const Operator* S32x4TransposeLeft();
     562             :   const Operator* S32x4TransposeRight();
     563             :   const Operator* S32x4Select();
     564             :   const Operator* S16x8ZipLeft();
     565             :   const Operator* S16x8ZipRight();
     566             :   const Operator* S16x8UnzipLeft();
     567             :   const Operator* S16x8UnzipRight();
     568             :   const Operator* S16x8TransposeLeft();
     569             :   const Operator* S16x8TransposeRight();
     570             :   const Operator* S16x8Select();
     571             :   const Operator* S8x16ZipLeft();
     572             :   const Operator* S8x16ZipRight();
     573             :   const Operator* S8x16UnzipLeft();
     574             :   const Operator* S8x16UnzipRight();
     575             :   const Operator* S8x16TransposeLeft();
     576             :   const Operator* S8x16TransposeRight();
     577             :   const Operator* S8x16Select();
     578             :   const Operator* S8x16Concat(int32_t);
     579             : 
     580             :   const Operator* S32x2Reverse();
     581             :   const Operator* S16x4Reverse();
     582             :   const Operator* S16x2Reverse();
     583             :   const Operator* S8x8Reverse();
     584             :   const Operator* S8x4Reverse();
     585             :   const Operator* S8x2Reverse();
     586             : 
     587             :   const Operator* S1x4Zero();
     588             :   const Operator* S1x4And();
     589             :   const Operator* S1x4Or();
     590             :   const Operator* S1x4Xor();
     591             :   const Operator* S1x4Not();
     592             :   const Operator* S1x4AnyTrue();
     593             :   const Operator* S1x4AllTrue();
     594             : 
     595             :   const Operator* S1x8Zero();
     596             :   const Operator* S1x8And();
     597             :   const Operator* S1x8Or();
     598             :   const Operator* S1x8Xor();
     599             :   const Operator* S1x8Not();
     600             :   const Operator* S1x8AnyTrue();
     601             :   const Operator* S1x8AllTrue();
     602             : 
     603             :   const Operator* S1x16Zero();
     604             :   const Operator* S1x16And();
     605             :   const Operator* S1x16Or();
     606             :   const Operator* S1x16Xor();
     607             :   const Operator* S1x16Not();
     608             :   const Operator* S1x16AnyTrue();
     609             :   const Operator* S1x16AllTrue();
     610             : 
     611             :   // load [base + index]
     612             :   const Operator* Load(LoadRepresentation rep);
     613             :   const Operator* ProtectedLoad(LoadRepresentation rep);
     614             : 
     615             :   // store [base + index], value
     616             :   const Operator* Store(StoreRepresentation rep);
     617             :   const Operator* ProtectedStore(MachineRepresentation rep);
     618             : 
     619             :   // unaligned load [base + index]
     620             :   const Operator* UnalignedLoad(UnalignedLoadRepresentation rep);
     621             : 
     622             :   // unaligned store [base + index], value
     623             :   const Operator* UnalignedStore(UnalignedStoreRepresentation rep);
     624             : 
     625             :   const Operator* StackSlot(int size);
     626             :   const Operator* StackSlot(MachineRepresentation rep);
     627             : 
     628             :   // Access to the machine stack.
     629             :   const Operator* LoadStackPointer();
     630             :   const Operator* LoadFramePointer();
     631             :   const Operator* LoadParentFramePointer();
     632             : 
     633             :   // checked-load heap, index, length
     634             :   const Operator* CheckedLoad(CheckedLoadRepresentation);
     635             :   // checked-store heap, index, length, value
     636             :   const Operator* CheckedStore(CheckedStoreRepresentation);
     637             : 
     638             :   // atomic-load [base + index]
     639             :   const Operator* AtomicLoad(LoadRepresentation rep);
     640             :   // atomic-store [base + index], value
     641             :   const Operator* AtomicStore(MachineRepresentation rep);
     642             :   // atomic-exchange [base + index], value
     643             :   const Operator* AtomicExchange(MachineType rep);
     644             :   // atomic-compare-exchange [base + index], old_value, new_value
     645             :   const Operator* AtomicCompareExchange(MachineType rep);
     646             :   // atomic-add [base + index], value
     647             :   const Operator* AtomicAdd(MachineType rep);
     648             :   // atomic-sub [base + index], value
     649             :   const Operator* AtomicSub(MachineType rep);
     650             :   // atomic-and [base + index], value
     651             :   const Operator* AtomicAnd(MachineType rep);
     652             :   // atomic-or [base + index], value
     653             :   const Operator* AtomicOr(MachineType rep);
     654             :   // atomic-xor [base + index], value
     655             :   const Operator* AtomicXor(MachineType rep);
     656             : 
     657             :   // Target machine word-size assumed by this builder.
     658    10571461 :   bool Is32() const { return word() == MachineRepresentation::kWord32; }
     659     1177041 :   bool Is64() const { return word() == MachineRepresentation::kWord64; }
     660             :   MachineRepresentation word() const { return word_; }
     661             : 
     662             :   bool UnalignedLoadSupported(const MachineType& machineType,
     663             :                               uint8_t alignment) {
     664             :     return alignment_requirements_.IsUnalignedLoadSupported(machineType,
     665             :                                                             alignment);
     666             :   }
     667             : 
     668             :   bool UnalignedStoreSupported(const MachineType& machineType,
     669             :                                uint8_t alignment) {
     670             :     return alignment_requirements_.IsUnalignedStoreSupported(machineType,
     671             :                                                              alignment);
     672             :   }
     673             : 
     674             : // Pseudo operators that translate to 32/64-bit operators depending on the
     675             : // word-size of the target machine assumed by this builder.
     676             : #define PSEUDO_OP_LIST(V) \
     677             :   V(Word, And)            \
     678             :   V(Word, Or)             \
     679             :   V(Word, Xor)            \
     680             :   V(Word, Shl)            \
     681             :   V(Word, Shr)            \
     682             :   V(Word, Sar)            \
     683             :   V(Word, Ror)            \
     684             :   V(Word, Clz)            \
     685             :   V(Word, Equal)          \
     686             :   V(Int, Add)             \
     687             :   V(Int, Sub)             \
     688             :   V(Int, Mul)             \
     689             :   V(Int, Div)             \
     690             :   V(Int, Mod)             \
     691             :   V(Int, LessThan)        \
     692             :   V(Int, LessThanOrEqual) \
     693             :   V(Uint, Div)            \
     694             :   V(Uint, LessThan)       \
     695             :   V(Uint, Mod)
     696             : #define PSEUDO_OP(Prefix, Suffix)                                \
     697             :   const Operator* Prefix##Suffix() {                             \
     698             :     return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \
     699             :   }
     700     9892208 :   PSEUDO_OP_LIST(PSEUDO_OP)
     701             : #undef PSEUDO_OP
     702             : #undef PSEUDO_OP_LIST
     703             : 
     704             :  private:
     705             :   Zone* zone_;
     706             :   MachineOperatorGlobalCache const& cache_;
     707             :   MachineRepresentation const word_;
     708             :   Flags const flags_;
     709             :   AlignmentRequirements const alignment_requirements_;
     710             : 
     711             :   DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder);
     712             : };
     713             : 
     714             : 
     715             : DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
     716             : 
     717             : }  // namespace compiler
     718             : }  // namespace internal
     719             : }  // namespace v8
     720             : 
     721             : #endif  // V8_COMPILER_MACHINE_OPERATOR_H_

Generated by: LCOV version 1.10