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.
5 #ifndef V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
6 #define V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_
8 #include "src/compiler/machine-operator.h"
9 #include "src/compiler/machine-type.h"
10 #include "testing/gmock/include/gmock/gmock.h"
15 // Forward declarations.
16 class ExternalReference;
23 // Forward declarations.
30 using ::testing::Matcher;
33 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
34 const Matcher<Node*>& control_matcher);
35 Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
36 const Matcher<Node*>& control1_matcher);
37 Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
38 Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
39 Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher);
40 Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
41 const Matcher<Node*>& effect_matcher);
42 Matcher<Node*> IsExternalConstant(
43 const Matcher<ExternalReference>& value_matcher);
44 Matcher<Node*> IsHeapConstant(
45 const Matcher<Unique<HeapObject> >& value_matcher);
46 Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher);
47 Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
48 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
49 Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
50 Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
51 Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
52 const Matcher<Node*>& value0_matcher,
53 const Matcher<Node*>& value1_matcher,
54 const Matcher<Node*>& value2_matcher);
55 Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
56 const Matcher<Node*>& value0_matcher,
57 const Matcher<Node*>& value1_matcher,
58 const Matcher<Node*>& merge_matcher);
59 Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
60 const Matcher<Node*>& effect1_matcher,
61 const Matcher<Node*>& merge_matcher);
62 Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
63 const Matcher<Node*>& base_matcher);
64 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
65 const Matcher<Node*>& value0_matcher,
66 const Matcher<Node*>& value1_matcher,
67 const Matcher<Node*>& effect_matcher,
68 const Matcher<Node*>& control_matcher);
69 Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
70 const Matcher<Node*>& value0_matcher,
71 const Matcher<Node*>& value1_matcher,
72 const Matcher<Node*>& value2_matcher,
73 const Matcher<Node*>& value3_matcher,
74 const Matcher<Node*>& effect_matcher,
75 const Matcher<Node*>& control_matcher);
77 Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
78 Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
79 const Matcher<Node*>& rhs_matcher);
80 Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher,
81 const Matcher<Node*>& rhs_matcher);
82 Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher,
83 const Matcher<Node*>& rhs_matcher);
84 Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher,
85 const Matcher<Node*>& rhs_matcher);
86 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
87 const Matcher<Node*>& base_matcher,
88 const Matcher<Node*>& effect_matcher,
89 const Matcher<Node*>& control_matcher);
90 Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
91 const Matcher<Node*>& base_matcher,
92 const Matcher<Node*>& index_matcher,
93 const Matcher<Node*>& length_matcher,
94 const Matcher<Node*>& effect_matcher);
95 Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
96 const Matcher<Node*>& base_matcher,
97 const Matcher<Node*>& index_matcher,
98 const Matcher<Node*>& length_matcher,
99 const Matcher<Node*>& value_matcher,
100 const Matcher<Node*>& effect_matcher,
101 const Matcher<Node*>& control_matcher);
103 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
104 const Matcher<Node*>& base_matcher,
105 const Matcher<Node*>& index_matcher,
106 const Matcher<Node*>& effect_matcher,
107 const Matcher<Node*>& control_matcher);
108 Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
109 const Matcher<Node*>& base_matcher,
110 const Matcher<Node*>& index_matcher,
111 const Matcher<Node*>& value_matcher,
112 const Matcher<Node*>& effect_matcher,
113 const Matcher<Node*>& control_matcher);
114 Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
115 const Matcher<Node*>& rhs_matcher);
116 Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher,
117 const Matcher<Node*>& rhs_matcher);
118 Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
119 const Matcher<Node*>& rhs_matcher);
120 Matcher<Node*> IsWord32Shr(const Matcher<Node*>& lhs_matcher,
121 const Matcher<Node*>& rhs_matcher);
122 Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher,
123 const Matcher<Node*>& rhs_matcher);
124 Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher,
125 const Matcher<Node*>& rhs_matcher);
126 Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
127 const Matcher<Node*>& rhs_matcher);
128 Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher,
129 const Matcher<Node*>& rhs_matcher);
130 Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher,
131 const Matcher<Node*>& rhs_matcher);
132 Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher,
133 const Matcher<Node*>& rhs_matcher);
134 Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher,
135 const Matcher<Node*>& rhs_matcher);
136 Matcher<Node*> IsInt32Add(const Matcher<Node*>& lhs_matcher,
137 const Matcher<Node*>& rhs_matcher);
138 Matcher<Node*> IsInt32Sub(const Matcher<Node*>& lhs_matcher,
139 const Matcher<Node*>& rhs_matcher);
140 Matcher<Node*> IsInt32Mul(const Matcher<Node*>& lhs_matcher,
141 const Matcher<Node*>& rhs_matcher);
142 Matcher<Node*> IsInt32MulHigh(const Matcher<Node*>& lhs_matcher,
143 const Matcher<Node*>& rhs_matcher);
144 Matcher<Node*> IsInt32LessThan(const Matcher<Node*>& lhs_matcher,
145 const Matcher<Node*>& rhs_matcher);
146 Matcher<Node*> IsUint32LessThan(const Matcher<Node*>& lhs_matcher,
147 const Matcher<Node*>& rhs_matcher);
148 Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
149 const Matcher<Node*>& rhs_matcher);
150 Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher);
151 Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher);
152 Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher);
153 Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher);
154 Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher);
155 Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher);
156 Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher);
157 Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher);
158 Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
159 Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher);
160 Matcher<Node*> IsFloat64Floor(const Matcher<Node*>& input_matcher);
161 Matcher<Node*> IsFloat64Ceil(const Matcher<Node*>& input_matcher);
162 Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher);
163 Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher);
165 } // namespace compiler
166 } // namespace internal
169 #endif // V8_UNITTESTS_COMPILER_NODE_TEST_UTILS_H_