Home | History | Annotate | Download | only in compiler
      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       : 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 typedef LoadRepresentation ProtectedLoadRepresentation;
     47 
     48 LoadRepresentation LoadRepresentationOf(Operator const*);
     49 
     50 // A Store needs a MachineType and a WriteBarrierKind in order to emit the
     51 // correct write barrier.
     52 class StoreRepresentation final {
     53  public:
     54   StoreRepresentation(MachineRepresentation representation,
     55                       WriteBarrierKind write_barrier_kind)
     56       : representation_(representation),
     57         write_barrier_kind_(write_barrier_kind) {}
     58 
     59   MachineRepresentation representation() const { return representation_; }
     60   WriteBarrierKind write_barrier_kind() const { return write_barrier_kind_; }
     61 
     62  private:
     63   MachineRepresentation representation_;
     64   WriteBarrierKind write_barrier_kind_;
     65 };
     66 
     67 V8_EXPORT_PRIVATE bool operator==(StoreRepresentation, StoreRepresentation);
     68 bool operator!=(StoreRepresentation, StoreRepresentation);
     69 
     70 size_t hash_value(StoreRepresentation);
     71 
     72 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, StoreRepresentation);
     73 
     74 StoreRepresentation const& StoreRepresentationOf(Operator const*);
     75 
     76 typedef MachineType UnalignedLoadRepresentation;
     77 
     78 UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const*);
     79 
     80 // An UnalignedStore needs a MachineType.
     81 typedef MachineRepresentation UnalignedStoreRepresentation;
     82 
     83 UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
     84     Operator const*);
     85 
     86 // A CheckedLoad needs a MachineType.
     87 typedef MachineType CheckedLoadRepresentation;
     88 
     89 CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const*);
     90 
     91 
     92 // A CheckedStore needs a MachineType.
     93 typedef MachineRepresentation CheckedStoreRepresentation;
     94 
     95 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const*);
     96 
     97 MachineRepresentation StackSlotRepresentationOf(Operator const* op);
     98 
     99 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op);
    100 
    101 // Interface for building machine-level operators. These operators are
    102 // machine-level but machine-independent and thus define a language suitable
    103 // for generating code to run on architectures such as ia32, x64, arm, etc.
    104 class V8_EXPORT_PRIVATE MachineOperatorBuilder final
    105     : public NON_EXPORTED_BASE(ZoneObject) {
    106  public:
    107   // Flags that specify which operations are available. This is useful
    108   // for operations that are unsupported by some back-ends.
    109   enum Flag : unsigned {
    110     kNoFlags = 0u,
    111     kFloat32RoundDown = 1u << 0,
    112     kFloat64RoundDown = 1u << 1,
    113     kFloat32RoundUp = 1u << 2,
    114     kFloat64RoundUp = 1u << 3,
    115     kFloat32RoundTruncate = 1u << 4,
    116     kFloat64RoundTruncate = 1u << 5,
    117     kFloat32RoundTiesEven = 1u << 6,
    118     kFloat64RoundTiesEven = 1u << 7,
    119     kFloat64RoundTiesAway = 1u << 8,
    120     kInt32DivIsSafe = 1u << 9,
    121     kUint32DivIsSafe = 1u << 10,
    122     kWord32ShiftIsSafe = 1u << 11,
    123     kWord32Ctz = 1u << 12,
    124     kWord64Ctz = 1u << 13,
    125     kWord32Popcnt = 1u << 14,
    126     kWord64Popcnt = 1u << 15,
    127     kWord32ReverseBits = 1u << 16,
    128     kWord64ReverseBits = 1u << 17,
    129     kWord32ReverseBytes = 1u << 18,
    130     kWord64ReverseBytes = 1u << 19,
    131     kAllOptionalOps = kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp |
    132                       kFloat64RoundUp | kFloat32RoundTruncate |
    133                       kFloat64RoundTruncate | kFloat64RoundTiesAway |
    134                       kFloat32RoundTiesEven | kFloat64RoundTiesEven |
    135                       kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt |
    136                       kWord32ReverseBits | kWord64ReverseBits |
    137                       kWord32ReverseBytes | kWord64ReverseBytes
    138   };
    139   typedef base::Flags<Flag, unsigned> Flags;
    140 
    141   class AlignmentRequirements {
    142    public:
    143     enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport };
    144 
    145     bool IsUnalignedLoadSupported(const MachineType& machineType,
    146                                   uint8_t alignment) const {
    147       return IsUnalignedSupported(unalignedLoadUnsupportedTypes_, machineType,
    148                                   alignment);
    149     }
    150 
    151     bool IsUnalignedStoreSupported(const MachineType& machineType,
    152                                    uint8_t alignment) const {
    153       return IsUnalignedSupported(unalignedStoreUnsupportedTypes_, machineType,
    154                                   alignment);
    155     }
    156 
    157     static AlignmentRequirements FullUnalignedAccessSupport() {
    158       return AlignmentRequirements(kFullSupport);
    159     }
    160     static AlignmentRequirements NoUnalignedAccessSupport() {
    161       return AlignmentRequirements(kNoSupport);
    162     }
    163     static AlignmentRequirements SomeUnalignedAccessUnsupported(
    164         const Vector<MachineType>& unalignedLoadUnsupportedTypes,
    165         const Vector<MachineType>& unalignedStoreUnsupportedTypes) {
    166       return AlignmentRequirements(kSomeSupport, unalignedLoadUnsupportedTypes,
    167                                    unalignedStoreUnsupportedTypes);
    168     }
    169 
    170    private:
    171     explicit AlignmentRequirements(
    172         AlignmentRequirements::UnalignedAccessSupport unalignedAccessSupport,
    173         Vector<MachineType> unalignedLoadUnsupportedTypes =
    174             Vector<MachineType>(NULL, 0),
    175         Vector<MachineType> unalignedStoreUnsupportedTypes =
    176             Vector<MachineType>(NULL, 0))
    177         : unalignedSupport_(unalignedAccessSupport),
    178           unalignedLoadUnsupportedTypes_(unalignedLoadUnsupportedTypes),
    179           unalignedStoreUnsupportedTypes_(unalignedStoreUnsupportedTypes) {}
    180 
    181     bool IsUnalignedSupported(const Vector<MachineType>& unsupported,
    182                               const MachineType& machineType,
    183                               uint8_t alignment) const {
    184       if (unalignedSupport_ == kFullSupport) {
    185         return true;
    186       } else if (unalignedSupport_ == kNoSupport) {
    187         return false;
    188       } else {
    189         for (MachineType m : unsupported) {
    190           if (m == machineType) {
    191             return false;
    192           }
    193         }
    194         return true;
    195       }
    196     }
    197 
    198     const AlignmentRequirements::UnalignedAccessSupport unalignedSupport_;
    199     const Vector<MachineType> unalignedLoadUnsupportedTypes_;
    200     const Vector<MachineType> unalignedStoreUnsupportedTypes_;
    201   };
    202 
    203   explicit MachineOperatorBuilder(
    204       Zone* zone,
    205       MachineRepresentation word = MachineType::PointerRepresentation(),
    206       Flags supportedOperators = kNoFlags,
    207       AlignmentRequirements alignmentRequirements =
    208           AlignmentRequirements::FullUnalignedAccessSupport());
    209 
    210   const Operator* Comment(const char* msg);
    211   const Operator* DebugBreak();
    212   const Operator* UnsafePointerAdd();
    213 
    214   const Operator* Word32And();
    215   const Operator* Word32Or();
    216   const Operator* Word32Xor();
    217   const Operator* Word32Shl();
    218   const Operator* Word32Shr();
    219   const Operator* Word32Sar();
    220   const Operator* Word32Ror();
    221   const Operator* Word32Equal();
    222   const Operator* Word32Clz();
    223   const OptionalOperator Word32Ctz();
    224   const OptionalOperator Word32Popcnt();
    225   const OptionalOperator Word64Popcnt();
    226   const OptionalOperator Word32ReverseBits();
    227   const OptionalOperator Word64ReverseBits();
    228   const OptionalOperator Word32ReverseBytes();
    229   const OptionalOperator Word64ReverseBytes();
    230   bool Word32ShiftIsSafe() const { return flags_ & kWord32ShiftIsSafe; }
    231 
    232   const Operator* Word64And();
    233   const Operator* Word64Or();
    234   const Operator* Word64Xor();
    235   const Operator* Word64Shl();
    236   const Operator* Word64Shr();
    237   const Operator* Word64Sar();
    238   const Operator* Word64Ror();
    239   const Operator* Word64Clz();
    240   const OptionalOperator Word64Ctz();
    241   const Operator* Word64Equal();
    242 
    243   const Operator* Int32PairAdd();
    244   const Operator* Int32PairSub();
    245   const Operator* Int32PairMul();
    246   const Operator* Word32PairShl();
    247   const Operator* Word32PairShr();
    248   const Operator* Word32PairSar();
    249 
    250   const Operator* Int32Add();
    251   const Operator* Int32AddWithOverflow();
    252   const Operator* Int32Sub();
    253   const Operator* Int32SubWithOverflow();
    254   const Operator* Int32Mul();
    255   const Operator* Int32MulWithOverflow();
    256   const Operator* Int32MulHigh();
    257   const Operator* Int32Div();
    258   const Operator* Int32Mod();
    259   const Operator* Int32LessThan();
    260   const Operator* Int32LessThanOrEqual();
    261   const Operator* Uint32Div();
    262   const Operator* Uint32LessThan();
    263   const Operator* Uint32LessThanOrEqual();
    264   const Operator* Uint32Mod();
    265   const Operator* Uint32MulHigh();
    266   bool Int32DivIsSafe() const { return flags_ & kInt32DivIsSafe; }
    267   bool Uint32DivIsSafe() const { return flags_ & kUint32DivIsSafe; }
    268 
    269   const Operator* Int64Add();
    270   const Operator* Int64AddWithOverflow();
    271   const Operator* Int64Sub();
    272   const Operator* Int64SubWithOverflow();
    273   const Operator* Int64Mul();
    274   const Operator* Int64Div();
    275   const Operator* Int64Mod();
    276   const Operator* Int64LessThan();
    277   const Operator* Int64LessThanOrEqual();
    278   const Operator* Uint64Div();
    279   const Operator* Uint64LessThan();
    280   const Operator* Uint64LessThanOrEqual();
    281   const Operator* Uint64Mod();
    282 
    283   // This operator reinterprets the bits of a tagged pointer as word.
    284   const Operator* BitcastTaggedToWord();
    285 
    286   // This operator reinterprets the bits of a word as tagged pointer.
    287   const Operator* BitcastWordToTagged();
    288 
    289   // This operator reinterprets the bits of a word as a Smi.
    290   const Operator* BitcastWordToTaggedSigned();
    291 
    292   // JavaScript float64 to int32/uint32 truncation.
    293   const Operator* TruncateFloat64ToWord32();
    294 
    295   // These operators change the representation of numbers while preserving the
    296   // value of the number. Narrowing operators assume the input is representable
    297   // in the target type and are *not* defined for other inputs.
    298   // Use narrowing change operators only when there is a static guarantee that
    299   // the input value is representable in the target value.
    300   const Operator* ChangeFloat32ToFloat64();
    301   const Operator* ChangeFloat64ToInt32();   // narrowing
    302   const Operator* ChangeFloat64ToUint32();  // narrowing
    303   const Operator* TruncateFloat64ToUint32();
    304   const Operator* TruncateFloat32ToInt32();
    305   const Operator* TruncateFloat32ToUint32();
    306   const Operator* TryTruncateFloat32ToInt64();
    307   const Operator* TryTruncateFloat64ToInt64();
    308   const Operator* TryTruncateFloat32ToUint64();
    309   const Operator* TryTruncateFloat64ToUint64();
    310   const Operator* ChangeInt32ToFloat64();
    311   const Operator* ChangeInt32ToInt64();
    312   const Operator* ChangeUint32ToFloat64();
    313   const Operator* ChangeUint32ToUint64();
    314 
    315   // These operators truncate or round numbers, both changing the representation
    316   // of the number and mapping multiple input values onto the same output value.
    317   const Operator* TruncateFloat64ToFloat32();
    318   const Operator* TruncateInt64ToInt32();
    319   const Operator* RoundFloat64ToInt32();
    320   const Operator* RoundInt32ToFloat32();
    321   const Operator* RoundInt64ToFloat32();
    322   const Operator* RoundInt64ToFloat64();
    323   const Operator* RoundUint32ToFloat32();
    324   const Operator* RoundUint64ToFloat32();
    325   const Operator* RoundUint64ToFloat64();
    326 
    327   // These operators reinterpret the bits of a floating point number as an
    328   // integer and vice versa.
    329   const Operator* BitcastFloat32ToInt32();
    330   const Operator* BitcastFloat64ToInt64();
    331   const Operator* BitcastInt32ToFloat32();
    332   const Operator* BitcastInt64ToFloat64();
    333 
    334   // Floating point operators always operate with IEEE 754 round-to-nearest
    335   // (single-precision).
    336   const Operator* Float32Add();
    337   const Operator* Float32Sub();
    338   const Operator* Float32Mul();
    339   const Operator* Float32Div();
    340   const Operator* Float32Sqrt();
    341 
    342   // Floating point operators always operate with IEEE 754 round-to-nearest
    343   // (double-precision).
    344   const Operator* Float64Add();
    345   const Operator* Float64Sub();
    346   const Operator* Float64Mul();
    347   const Operator* Float64Div();
    348   const Operator* Float64Mod();
    349   const Operator* Float64Sqrt();
    350 
    351   // Floating point comparisons complying to IEEE 754 (single-precision).
    352   const Operator* Float32Equal();
    353   const Operator* Float32LessThan();
    354   const Operator* Float32LessThanOrEqual();
    355 
    356   // Floating point comparisons complying to IEEE 754 (double-precision).
    357   const Operator* Float64Equal();
    358   const Operator* Float64LessThan();
    359   const Operator* Float64LessThanOrEqual();
    360 
    361   // Floating point min/max complying to EcmaScript 6 (double-precision).
    362   const Operator* Float64Max();
    363   const Operator* Float64Min();
    364   // Floating point min/max complying to WebAssembly (single-precision).
    365   const Operator* Float32Max();
    366   const Operator* Float32Min();
    367 
    368   // Floating point abs complying to IEEE 754 (single-precision).
    369   const Operator* Float32Abs();
    370 
    371   // Floating point abs complying to IEEE 754 (double-precision).
    372   const Operator* Float64Abs();
    373 
    374   // Floating point rounding.
    375   const OptionalOperator Float32RoundDown();
    376   const OptionalOperator Float64RoundDown();
    377   const OptionalOperator Float32RoundUp();
    378   const OptionalOperator Float64RoundUp();
    379   const OptionalOperator Float32RoundTruncate();
    380   const OptionalOperator Float64RoundTruncate();
    381   const OptionalOperator Float64RoundTiesAway();
    382   const OptionalOperator Float32RoundTiesEven();
    383   const OptionalOperator Float64RoundTiesEven();
    384 
    385   // Floating point neg.
    386   const Operator* Float32Neg();
    387   const Operator* Float64Neg();
    388 
    389   // Floating point trigonometric functions (double-precision).
    390   const Operator* Float64Acos();
    391   const Operator* Float64Acosh();
    392   const Operator* Float64Asin();
    393   const Operator* Float64Asinh();
    394   const Operator* Float64Atan();
    395   const Operator* Float64Atan2();
    396   const Operator* Float64Atanh();
    397   const Operator* Float64Cos();
    398   const Operator* Float64Cosh();
    399   const Operator* Float64Sin();
    400   const Operator* Float64Sinh();
    401   const Operator* Float64Tan();
    402   const Operator* Float64Tanh();
    403 
    404   // Floating point exponential functions (double-precision).
    405   const Operator* Float64Exp();
    406   const Operator* Float64Expm1();
    407   const Operator* Float64Pow();
    408 
    409   // Floating point logarithm (double-precision).
    410   const Operator* Float64Log();
    411   const Operator* Float64Log1p();
    412   const Operator* Float64Log2();
    413   const Operator* Float64Log10();
    414 
    415   // Floating point cube root (double-precision).
    416   const Operator* Float64Cbrt();
    417 
    418   // Floating point bit representation.
    419   const Operator* Float64ExtractLowWord32();
    420   const Operator* Float64ExtractHighWord32();
    421   const Operator* Float64InsertLowWord32();
    422   const Operator* Float64InsertHighWord32();
    423 
    424   // Change signalling NaN to quiet NaN.
    425   // Identity for any input that is not signalling NaN.
    426   const Operator* Float64SilenceNaN();
    427 
    428   // SIMD operators.
    429   const Operator* CreateFloat32x4();
    430   const Operator* Float32x4ExtractLane();
    431   const Operator* Float32x4ReplaceLane();
    432   const Operator* Float32x4Abs();
    433   const Operator* Float32x4Neg();
    434   const Operator* Float32x4Sqrt();
    435   const Operator* Float32x4RecipApprox();
    436   const Operator* Float32x4RecipSqrtApprox();
    437   const Operator* Float32x4Add();
    438   const Operator* Float32x4Sub();
    439   const Operator* Float32x4Mul();
    440   const Operator* Float32x4Div();
    441   const Operator* Float32x4Min();
    442   const Operator* Float32x4Max();
    443   const Operator* Float32x4MinNum();
    444   const Operator* Float32x4MaxNum();
    445   const Operator* Float32x4Equal();
    446   const Operator* Float32x4NotEqual();
    447   const Operator* Float32x4LessThan();
    448   const Operator* Float32x4LessThanOrEqual();
    449   const Operator* Float32x4GreaterThan();
    450   const Operator* Float32x4GreaterThanOrEqual();
    451   const Operator* Float32x4Select();
    452   const Operator* Float32x4Swizzle();
    453   const Operator* Float32x4Shuffle();
    454   const Operator* Float32x4FromInt32x4();
    455   const Operator* Float32x4FromUint32x4();
    456 
    457   const Operator* CreateInt32x4();
    458   const Operator* Int32x4ExtractLane();
    459   const Operator* Int32x4ReplaceLane();
    460   const Operator* Int32x4Neg();
    461   const Operator* Int32x4Add();
    462   const Operator* Int32x4Sub();
    463   const Operator* Int32x4Mul();
    464   const Operator* Int32x4Min();
    465   const Operator* Int32x4Max();
    466   const Operator* Int32x4ShiftLeftByScalar();
    467   const Operator* Int32x4ShiftRightByScalar();
    468   const Operator* Int32x4Equal();
    469   const Operator* Int32x4NotEqual();
    470   const Operator* Int32x4LessThan();
    471   const Operator* Int32x4LessThanOrEqual();
    472   const Operator* Int32x4GreaterThan();
    473   const Operator* Int32x4GreaterThanOrEqual();
    474   const Operator* Int32x4Select();
    475   const Operator* Int32x4Swizzle();
    476   const Operator* Int32x4Shuffle();
    477   const Operator* Int32x4FromFloat32x4();
    478 
    479   const Operator* Uint32x4Min();
    480   const Operator* Uint32x4Max();
    481   const Operator* Uint32x4ShiftLeftByScalar();
    482   const Operator* Uint32x4ShiftRightByScalar();
    483   const Operator* Uint32x4LessThan();
    484   const Operator* Uint32x4LessThanOrEqual();
    485   const Operator* Uint32x4GreaterThan();
    486   const Operator* Uint32x4GreaterThanOrEqual();
    487   const Operator* Uint32x4FromFloat32x4();
    488 
    489   const Operator* CreateBool32x4();
    490   const Operator* Bool32x4ExtractLane();
    491   const Operator* Bool32x4ReplaceLane();
    492   const Operator* Bool32x4And();
    493   const Operator* Bool32x4Or();
    494   const Operator* Bool32x4Xor();
    495   const Operator* Bool32x4Not();
    496   const Operator* Bool32x4AnyTrue();
    497   const Operator* Bool32x4AllTrue();
    498   const Operator* Bool32x4Swizzle();
    499   const Operator* Bool32x4Shuffle();
    500   const Operator* Bool32x4Equal();
    501   const Operator* Bool32x4NotEqual();
    502 
    503   const Operator* CreateInt16x8();
    504   const Operator* Int16x8ExtractLane();
    505   const Operator* Int16x8ReplaceLane();
    506   const Operator* Int16x8Neg();
    507   const Operator* Int16x8Add();
    508   const Operator* Int16x8AddSaturate();
    509   const Operator* Int16x8Sub();
    510   const Operator* Int16x8SubSaturate();
    511   const Operator* Int16x8Mul();
    512   const Operator* Int16x8Min();
    513   const Operator* Int16x8Max();
    514   const Operator* Int16x8ShiftLeftByScalar();
    515   const Operator* Int16x8ShiftRightByScalar();
    516   const Operator* Int16x8Equal();
    517   const Operator* Int16x8NotEqual();
    518   const Operator* Int16x8LessThan();
    519   const Operator* Int16x8LessThanOrEqual();
    520   const Operator* Int16x8GreaterThan();
    521   const Operator* Int16x8GreaterThanOrEqual();
    522   const Operator* Int16x8Select();
    523   const Operator* Int16x8Swizzle();
    524   const Operator* Int16x8Shuffle();
    525 
    526   const Operator* Uint16x8AddSaturate();
    527   const Operator* Uint16x8SubSaturate();
    528   const Operator* Uint16x8Min();
    529   const Operator* Uint16x8Max();
    530   const Operator* Uint16x8ShiftLeftByScalar();
    531   const Operator* Uint16x8ShiftRightByScalar();
    532   const Operator* Uint16x8LessThan();
    533   const Operator* Uint16x8LessThanOrEqual();
    534   const Operator* Uint16x8GreaterThan();
    535   const Operator* Uint16x8GreaterThanOrEqual();
    536 
    537   const Operator* CreateBool16x8();
    538   const Operator* Bool16x8ExtractLane();
    539   const Operator* Bool16x8ReplaceLane();
    540   const Operator* Bool16x8And();
    541   const Operator* Bool16x8Or();
    542   const Operator* Bool16x8Xor();
    543   const Operator* Bool16x8Not();
    544   const Operator* Bool16x8AnyTrue();
    545   const Operator* Bool16x8AllTrue();
    546   const Operator* Bool16x8Swizzle();
    547   const Operator* Bool16x8Shuffle();
    548   const Operator* Bool16x8Equal();
    549   const Operator* Bool16x8NotEqual();
    550 
    551   const Operator* CreateInt8x16();
    552   const Operator* Int8x16ExtractLane();
    553   const Operator* Int8x16ReplaceLane();
    554   const Operator* Int8x16Neg();
    555   const Operator* Int8x16Add();
    556   const Operator* Int8x16AddSaturate();
    557   const Operator* Int8x16Sub();
    558   const Operator* Int8x16SubSaturate();
    559   const Operator* Int8x16Mul();
    560   const Operator* Int8x16Min();
    561   const Operator* Int8x16Max();
    562   const Operator* Int8x16ShiftLeftByScalar();
    563   const Operator* Int8x16ShiftRightByScalar();
    564   const Operator* Int8x16Equal();
    565   const Operator* Int8x16NotEqual();
    566   const Operator* Int8x16LessThan();
    567   const Operator* Int8x16LessThanOrEqual();
    568   const Operator* Int8x16GreaterThan();
    569   const Operator* Int8x16GreaterThanOrEqual();
    570   const Operator* Int8x16Select();
    571   const Operator* Int8x16Swizzle();
    572   const Operator* Int8x16Shuffle();
    573 
    574   const Operator* Uint8x16AddSaturate();
    575   const Operator* Uint8x16SubSaturate();
    576   const Operator* Uint8x16Min();
    577   const Operator* Uint8x16Max();
    578   const Operator* Uint8x16ShiftLeftByScalar();
    579   const Operator* Uint8x16ShiftRightByScalar();
    580   const Operator* Uint8x16LessThan();
    581   const Operator* Uint8x16LessThanOrEqual();
    582   const Operator* Uint8x16GreaterThan();
    583   const Operator* Uint8x16GreaterThanOrEqual();
    584 
    585   const Operator* CreateBool8x16();
    586   const Operator* Bool8x16ExtractLane();
    587   const Operator* Bool8x16ReplaceLane();
    588   const Operator* Bool8x16And();
    589   const Operator* Bool8x16Or();
    590   const Operator* Bool8x16Xor();
    591   const Operator* Bool8x16Not();
    592   const Operator* Bool8x16AnyTrue();
    593   const Operator* Bool8x16AllTrue();
    594   const Operator* Bool8x16Swizzle();
    595   const Operator* Bool8x16Shuffle();
    596   const Operator* Bool8x16Equal();
    597   const Operator* Bool8x16NotEqual();
    598 
    599   const Operator* Simd128Load();
    600   const Operator* Simd128Load1();
    601   const Operator* Simd128Load2();
    602   const Operator* Simd128Load3();
    603   const Operator* Simd128Store();
    604   const Operator* Simd128Store1();
    605   const Operator* Simd128Store2();
    606   const Operator* Simd128Store3();
    607   const Operator* Simd128And();
    608   const Operator* Simd128Or();
    609   const Operator* Simd128Xor();
    610   const Operator* Simd128Not();
    611 
    612   // load [base + index]
    613   const Operator* Load(LoadRepresentation rep);
    614   const Operator* ProtectedLoad(LoadRepresentation rep);
    615 
    616   // store [base + index], value
    617   const Operator* Store(StoreRepresentation 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(MachineRepresentation rep);
    626 
    627   // Access to the machine stack.
    628   const Operator* LoadStackPointer();
    629   const Operator* LoadFramePointer();
    630   const Operator* LoadParentFramePointer();
    631 
    632   // checked-load heap, index, length
    633   const Operator* CheckedLoad(CheckedLoadRepresentation);
    634   // checked-store heap, index, length, value
    635   const Operator* CheckedStore(CheckedStoreRepresentation);
    636 
    637   // atomic-load [base + index]
    638   const Operator* AtomicLoad(LoadRepresentation rep);
    639   // atomic-store [base + index], value
    640   const Operator* AtomicStore(MachineRepresentation rep);
    641 
    642   // Target machine word-size assumed by this builder.
    643   bool Is32() const { return word() == MachineRepresentation::kWord32; }
    644   bool Is64() const { return word() == MachineRepresentation::kWord64; }
    645   MachineRepresentation word() const { return word_; }
    646 
    647   bool UnalignedLoadSupported(const MachineType& machineType,
    648                               uint8_t alignment) {
    649     return alignment_requirements_.IsUnalignedLoadSupported(machineType,
    650                                                             alignment);
    651   }
    652 
    653   bool UnalignedStoreSupported(const MachineType& machineType,
    654                                uint8_t alignment) {
    655     return alignment_requirements_.IsUnalignedStoreSupported(machineType,
    656                                                              alignment);
    657   }
    658 
    659 // Pseudo operators that translate to 32/64-bit operators depending on the
    660 // word-size of the target machine assumed by this builder.
    661 #define PSEUDO_OP_LIST(V) \
    662   V(Word, And)            \
    663   V(Word, Or)             \
    664   V(Word, Xor)            \
    665   V(Word, Shl)            \
    666   V(Word, Shr)            \
    667   V(Word, Sar)            \
    668   V(Word, Ror)            \
    669   V(Word, Clz)            \
    670   V(Word, Equal)          \
    671   V(Int, Add)             \
    672   V(Int, Sub)             \
    673   V(Int, Mul)             \
    674   V(Int, Div)             \
    675   V(Int, Mod)             \
    676   V(Int, LessThan)        \
    677   V(Int, LessThanOrEqual) \
    678   V(Uint, Div)            \
    679   V(Uint, LessThan)       \
    680   V(Uint, Mod)
    681 #define PSEUDO_OP(Prefix, Suffix)                                \
    682   const Operator* Prefix##Suffix() {                             \
    683     return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \
    684   }
    685   PSEUDO_OP_LIST(PSEUDO_OP)
    686 #undef PSEUDO_OP
    687 #undef PSEUDO_OP_LIST
    688 
    689  private:
    690   Zone* zone_;
    691   MachineOperatorGlobalCache const& cache_;
    692   MachineRepresentation const word_;
    693   Flags const flags_;
    694   AlignmentRequirements const alignment_requirements_;
    695 
    696   DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder);
    697 };
    698 
    699 
    700 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
    701 
    702 }  // namespace compiler
    703 }  // namespace internal
    704 }  // namespace v8
    705 
    706 #endif  // V8_COMPILER_MACHINE_OPERATOR_H_
    707