Index: src/compiler/node-matchers.h |
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h |
index 19089c5d6c4219fc085e37547f7fd69980f73273..a4f80c6ed8e198972ae1815d32c2af90f4ce982d 100644 |
--- a/src/compiler/node-matchers.h |
+++ b/src/compiler/node-matchers.h |
@@ -396,14 +396,15 @@ enum DisplacementMode { kPositiveDisplacement, kNegativeDisplacement }; |
template <class AddMatcher> |
struct BaseWithIndexAndDisplacementMatcher { |
- BaseWithIndexAndDisplacementMatcher(Node* node, bool allow_input_swap) |
+ BaseWithIndexAndDisplacementMatcher(Node* node, bool allow_input_swap, |
Benedikt Meurer
2016/08/12 17:57:06
Can you turn these two booleans into flags? Using
|
+ bool allow_scale = true) |
: matches_(false), |
index_(nullptr), |
scale_(0), |
base_(nullptr), |
displacement_(nullptr), |
displacement_mode_(kPositiveDisplacement) { |
- Initialize(node, allow_input_swap); |
+ Initialize(node, allow_input_swap, allow_scale); |
} |
explicit BaseWithIndexAndDisplacementMatcher(Node* node) |
@@ -413,7 +414,7 @@ struct BaseWithIndexAndDisplacementMatcher { |
base_(nullptr), |
displacement_(nullptr), |
displacement_mode_(kPositiveDisplacement) { |
- Initialize(node, node->op()->HasProperty(Operator::kCommutative)); |
+ Initialize(node, node->op()->HasProperty(Operator::kCommutative), true); |
} |
bool matches() const { return matches_; } |
@@ -431,7 +432,7 @@ struct BaseWithIndexAndDisplacementMatcher { |
Node* displacement_; |
DisplacementMode displacement_mode_; |
- void Initialize(Node* node, bool allow_input_swap) { |
+ void Initialize(Node* node, bool allow_input_swap, bool allow_scale) { |
// The BaseWithIndexAndDisplacementMatcher canonicalizes the order of |
// displacements and scale factors that are used as inputs, so instead of |
// enumerating all possible patterns by brute force, checking for node |
@@ -608,6 +609,10 @@ struct BaseWithIndexAndDisplacementMatcher { |
base = index; |
} |
} |
+ if (!allow_scale && scale != 0) { |
+ index = scale_expression; |
+ scale = 0; |
+ } |
base_ = base; |
displacement_ = displacement; |
displacement_mode_ = displacement_mode; |