Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 1 | // Copyright 2014 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_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_ |
| 6 | #define V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_ |
| 7 | |
| 8 | #include "src/compiler/machine-operator.h" |
| 9 | #include "src/compiler/machine-type.h" |
| 10 | #include "testing/gmock/include/gmock/gmock.h" |
| 11 | |
| 12 | namespace v8 { |
| 13 | namespace internal { |
| 14 | |
| 15 | // Forward declarations. |
| 16 | class ExternalReference; |
| 17 | class HeapObject; |
| 18 | template <class T> |
| 19 | class Unique; |
| 20 | |
| 21 | namespace compiler { |
| 22 | |
| 23 | // Forward declarations. |
| 24 | class BufferAccess; |
| 25 | class CallDescriptor; |
| 26 | struct ElementAccess; |
| 27 | struct FieldAccess; |
| 28 | class Node; |
| 29 | |
| 30 | |
| 31 | using ::testing::Matcher; |
| 32 | |
| 33 | |
| 34 | Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, |
| 35 | const Matcher<Node*>& control_matcher); |
| 36 | Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher, |
| 37 | const Matcher<Node*>& control1_matcher); |
| 38 | Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher); |
| 39 | Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher); |
| 40 | Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher); |
| 41 | Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher, |
| 42 | const Matcher<Node*>& effect_matcher); |
| 43 | Matcher<Node*> IsExternalConstant( |
| 44 | const Matcher<ExternalReference>& value_matcher); |
| 45 | Matcher<Node*> IsHeapConstant( |
| 46 | const Matcher<Unique<HeapObject> >& value_matcher); |
| 47 | Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher); |
| 48 | Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher); |
| 49 | Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher); |
| 50 | Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher); |
| 51 | Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher); |
| 52 | Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher, |
| 53 | const Matcher<Node*>& value0_matcher, |
| 54 | const Matcher<Node*>& value1_matcher, |
| 55 | const Matcher<Node*>& value2_matcher); |
| 56 | Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher, |
| 57 | const Matcher<Node*>& value0_matcher, |
| 58 | const Matcher<Node*>& value1_matcher, |
| 59 | const Matcher<Node*>& merge_matcher); |
| 60 | Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher, |
| 61 | const Matcher<Node*>& effect1_matcher, |
| 62 | const Matcher<Node*>& merge_matcher); |
| 63 | Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher, |
| 64 | const Matcher<Node*>& base_matcher); |
| 65 | Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, |
| 66 | const Matcher<Node*>& value0_matcher, |
| 67 | const Matcher<Node*>& value1_matcher, |
| 68 | const Matcher<Node*>& effect_matcher, |
| 69 | const Matcher<Node*>& control_matcher); |
| 70 | Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher, |
| 71 | const Matcher<Node*>& value0_matcher, |
| 72 | const Matcher<Node*>& value1_matcher, |
| 73 | const Matcher<Node*>& value2_matcher, |
| 74 | const Matcher<Node*>& value3_matcher, |
| 75 | const Matcher<Node*>& effect_matcher, |
| 76 | const Matcher<Node*>& control_matcher); |
| 77 | |
| 78 | Matcher<Node*> IsAnyToBoolean(const Matcher<Node*>& value_matcher); |
| 79 | Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher); |
| 80 | Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher, |
| 81 | const Matcher<Node*>& rhs_matcher); |
| 82 | Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher, |
| 83 | const Matcher<Node*>& rhs_matcher); |
| 84 | Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher, |
| 85 | const Matcher<Node*>& rhs_matcher); |
| 86 | Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher, |
| 87 | const Matcher<Node*>& rhs_matcher); |
| 88 | Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
| 89 | const Matcher<Node*>& base_matcher, |
| 90 | const Matcher<Node*>& effect_matcher, |
| 91 | const Matcher<Node*>& control_matcher); |
| 92 | Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher, |
| 93 | const Matcher<Node*>& base_matcher, |
| 94 | const Matcher<Node*>& value_matcher, |
| 95 | const Matcher<Node*>& effect_matcher, |
| 96 | const Matcher<Node*>& control_matcher); |
| 97 | Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher, |
| 98 | const Matcher<Node*>& buffer_matcher, |
| 99 | const Matcher<Node*>& offset_matcher, |
| 100 | const Matcher<Node*>& length_matcher, |
| 101 | const Matcher<Node*>& effect_matcher, |
| 102 | const Matcher<Node*>& control_matcher); |
| 103 | Matcher<Node*> IsStoreBuffer(const Matcher<BufferAccess>& access_matcher, |
| 104 | const Matcher<Node*>& buffer_matcher, |
| 105 | const Matcher<Node*>& offset_matcher, |
| 106 | const Matcher<Node*>& length_matcher, |
| 107 | const Matcher<Node*>& value_matcher, |
| 108 | const Matcher<Node*>& effect_matcher, |
| 109 | const Matcher<Node*>& control_matcher); |
| 110 | Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher, |
| 111 | const Matcher<Node*>& base_matcher, |
| 112 | const Matcher<Node*>& index_matcher, |
| 113 | const Matcher<Node*>& control_matcher, |
| 114 | const Matcher<Node*>& effect_matcher); |
| 115 | Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher, |
| 116 | const Matcher<Node*>& base_matcher, |
| 117 | const Matcher<Node*>& index_matcher, |
| 118 | const Matcher<Node*>& value_matcher, |
| 119 | const Matcher<Node*>& effect_matcher, |
| 120 | const Matcher<Node*>& control_matcher); |
| 121 | |
| 122 | Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, |
| 123 | const Matcher<Node*>& base_matcher, |
| 124 | const Matcher<Node*>& index_matcher, |
| 125 | const Matcher<Node*>& effect_matcher, |
| 126 | const Matcher<Node*>& control_matcher); |
| 127 | Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher, |
| 128 | const Matcher<Node*>& base_matcher, |
| 129 | const Matcher<Node*>& index_matcher, |
| 130 | const Matcher<Node*>& value_matcher, |
| 131 | const Matcher<Node*>& effect_matcher, |
| 132 | const Matcher<Node*>& control_matcher); |
| 133 | Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher, |
| 134 | const Matcher<Node*>& rhs_matcher); |
| 135 | Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher, |
| 136 | const Matcher<Node*>& rhs_matcher); |
| 137 | Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher, |
| 138 | const Matcher<Node*>& rhs_matcher); |
| 139 | Matcher<Node*> IsWord32Shr(const Matcher<Node*>& lhs_matcher, |
| 140 | const Matcher<Node*>& rhs_matcher); |
| 141 | Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher, |
| 142 | const Matcher<Node*>& rhs_matcher); |
| 143 | Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher, |
| 144 | const Matcher<Node*>& rhs_matcher); |
| 145 | Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher, |
| 146 | const Matcher<Node*>& rhs_matcher); |
| 147 | Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher, |
| 148 | const Matcher<Node*>& rhs_matcher); |
| 149 | Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher, |
| 150 | const Matcher<Node*>& rhs_matcher); |
| 151 | Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher, |
| 152 | const Matcher<Node*>& rhs_matcher); |
| 153 | Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher, |
| 154 | const Matcher<Node*>& rhs_matcher); |
| 155 | Matcher<Node*> IsInt32Add(const Matcher<Node*>& lhs_matcher, |
| 156 | const Matcher<Node*>& rhs_matcher); |
| 157 | Matcher<Node*> IsInt32Sub(const Matcher<Node*>& lhs_matcher, |
| 158 | const Matcher<Node*>& rhs_matcher); |
| 159 | Matcher<Node*> IsInt32Mul(const Matcher<Node*>& lhs_matcher, |
| 160 | const Matcher<Node*>& rhs_matcher); |
| 161 | Matcher<Node*> IsInt32MulHigh(const Matcher<Node*>& lhs_matcher, |
| 162 | const Matcher<Node*>& rhs_matcher); |
| 163 | Matcher<Node*> IsInt32LessThan(const Matcher<Node*>& lhs_matcher, |
| 164 | const Matcher<Node*>& rhs_matcher); |
| 165 | Matcher<Node*> IsUint32LessThan(const Matcher<Node*>& lhs_matcher, |
| 166 | const Matcher<Node*>& rhs_matcher); |
| 167 | Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher, |
| 168 | const Matcher<Node*>& rhs_matcher); |
| 169 | Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher); |
| 170 | Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher); |
| 171 | Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher); |
| 172 | Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher); |
| 173 | Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher); |
| 174 | Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher); |
| 175 | Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher); |
| 176 | Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher); |
| 177 | Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher); |
| 178 | Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher, |
| 179 | const Matcher<Node*>& rhs_matcher); |
| 180 | Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher); |
| 181 | Matcher<Node*> IsFloat64Floor(const Matcher<Node*>& input_matcher); |
| 182 | Matcher<Node*> IsFloat64Ceil(const Matcher<Node*>& input_matcher); |
| 183 | Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher); |
| 184 | Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher); |
| 185 | Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher, |
| 186 | const Matcher<Node*>& context_matcher, |
| 187 | const Matcher<Node*>& effect_matcher, |
| 188 | const Matcher<Node*>& control_matcher); |
| 189 | Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher); |
| 190 | Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher); |
| 191 | |
| 192 | } // namespace compiler |
| 193 | } // namespace internal |
| 194 | } // namespace v8 |
| 195 | |
| 196 | #endif // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_ |