blob: 02b6e4317551d43c1b5b5eebcf981b093d435c10 [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001// 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
12namespace v8 {
13namespace internal {
14
15// Forward declarations.
16class ExternalReference;
17class HeapObject;
18template <class T>
19class Unique;
20
21namespace compiler {
22
23// Forward declarations.
24class BufferAccess;
25class CallDescriptor;
26struct ElementAccess;
27struct FieldAccess;
28class Node;
29
30
31using ::testing::Matcher;
32
33
34Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
35 const Matcher<Node*>& control_matcher);
36Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
37 const Matcher<Node*>& control1_matcher);
38Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
39Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
40Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher);
41Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
42 const Matcher<Node*>& effect_matcher);
43Matcher<Node*> IsExternalConstant(
44 const Matcher<ExternalReference>& value_matcher);
45Matcher<Node*> IsHeapConstant(
46 const Matcher<Unique<HeapObject> >& value_matcher);
47Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher);
48Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
49Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
50Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
51Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
52Matcher<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);
56Matcher<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);
60Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
61 const Matcher<Node*>& effect1_matcher,
62 const Matcher<Node*>& merge_matcher);
63Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
64 const Matcher<Node*>& base_matcher);
65Matcher<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);
70Matcher<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
78Matcher<Node*> IsAnyToBoolean(const Matcher<Node*>& value_matcher);
79Matcher<Node*> IsBooleanNot(const Matcher<Node*>& value_matcher);
80Matcher<Node*> IsNumberEqual(const Matcher<Node*>& lhs_matcher,
81 const Matcher<Node*>& rhs_matcher);
82Matcher<Node*> IsNumberLessThan(const Matcher<Node*>& lhs_matcher,
83 const Matcher<Node*>& rhs_matcher);
84Matcher<Node*> IsNumberSubtract(const Matcher<Node*>& lhs_matcher,
85 const Matcher<Node*>& rhs_matcher);
86Matcher<Node*> IsNumberMultiply(const Matcher<Node*>& lhs_matcher,
87 const Matcher<Node*>& rhs_matcher);
88Matcher<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);
92Matcher<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);
97Matcher<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);
103Matcher<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);
110Matcher<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);
115Matcher<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
122Matcher<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);
127Matcher<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);
133Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
134 const Matcher<Node*>& rhs_matcher);
135Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher,
136 const Matcher<Node*>& rhs_matcher);
137Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
138 const Matcher<Node*>& rhs_matcher);
139Matcher<Node*> IsWord32Shr(const Matcher<Node*>& lhs_matcher,
140 const Matcher<Node*>& rhs_matcher);
141Matcher<Node*> IsWord32Ror(const Matcher<Node*>& lhs_matcher,
142 const Matcher<Node*>& rhs_matcher);
143Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher,
144 const Matcher<Node*>& rhs_matcher);
145Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
146 const Matcher<Node*>& rhs_matcher);
147Matcher<Node*> IsWord64Shl(const Matcher<Node*>& lhs_matcher,
148 const Matcher<Node*>& rhs_matcher);
149Matcher<Node*> IsWord64Sar(const Matcher<Node*>& lhs_matcher,
150 const Matcher<Node*>& rhs_matcher);
151Matcher<Node*> IsWord64Equal(const Matcher<Node*>& lhs_matcher,
152 const Matcher<Node*>& rhs_matcher);
153Matcher<Node*> IsInt32AddWithOverflow(const Matcher<Node*>& lhs_matcher,
154 const Matcher<Node*>& rhs_matcher);
155Matcher<Node*> IsInt32Add(const Matcher<Node*>& lhs_matcher,
156 const Matcher<Node*>& rhs_matcher);
157Matcher<Node*> IsInt32Sub(const Matcher<Node*>& lhs_matcher,
158 const Matcher<Node*>& rhs_matcher);
159Matcher<Node*> IsInt32Mul(const Matcher<Node*>& lhs_matcher,
160 const Matcher<Node*>& rhs_matcher);
161Matcher<Node*> IsInt32MulHigh(const Matcher<Node*>& lhs_matcher,
162 const Matcher<Node*>& rhs_matcher);
163Matcher<Node*> IsInt32LessThan(const Matcher<Node*>& lhs_matcher,
164 const Matcher<Node*>& rhs_matcher);
165Matcher<Node*> IsUint32LessThan(const Matcher<Node*>& lhs_matcher,
166 const Matcher<Node*>& rhs_matcher);
167Matcher<Node*> IsUint32LessThanOrEqual(const Matcher<Node*>& lhs_matcher,
168 const Matcher<Node*>& rhs_matcher);
169Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher);
170Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher);
171Matcher<Node*> IsChangeInt32ToFloat64(const Matcher<Node*>& input_matcher);
172Matcher<Node*> IsChangeInt32ToInt64(const Matcher<Node*>& input_matcher);
173Matcher<Node*> IsChangeUint32ToFloat64(const Matcher<Node*>& input_matcher);
174Matcher<Node*> IsChangeUint32ToUint64(const Matcher<Node*>& input_matcher);
175Matcher<Node*> IsTruncateFloat64ToFloat32(const Matcher<Node*>& input_matcher);
176Matcher<Node*> IsTruncateFloat64ToInt32(const Matcher<Node*>& input_matcher);
177Matcher<Node*> IsTruncateInt64ToInt32(const Matcher<Node*>& input_matcher);
178Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher,
179 const Matcher<Node*>& rhs_matcher);
180Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher);
181Matcher<Node*> IsFloat64Floor(const Matcher<Node*>& input_matcher);
182Matcher<Node*> IsFloat64Ceil(const Matcher<Node*>& input_matcher);
183Matcher<Node*> IsFloat64RoundTruncate(const Matcher<Node*>& input_matcher);
184Matcher<Node*> IsFloat64RoundTiesAway(const Matcher<Node*>& input_matcher);
185Matcher<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);
189Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher);
190Matcher<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_