2014-10-20 11:26:23 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "test/unittests/compiler/node-test-utils.h"
|
|
|
|
|
2015-04-23 09:04:37 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2014-12-23 12:50:43 +00:00
|
|
|
#include "src/assembler.h"
|
2015-06-02 09:37:49 +00:00
|
|
|
#include "src/compiler/js-operator.h"
|
2015-01-29 09:17:45 +00:00
|
|
|
#include "src/compiler/node-properties.h"
|
2014-10-20 11:26:23 +00:00
|
|
|
#include "src/compiler/simplified-operator.h"
|
2015-01-29 09:17:45 +00:00
|
|
|
#include "src/unique.h"
|
2014-10-20 11:26:23 +00:00
|
|
|
|
|
|
|
using testing::_;
|
|
|
|
using testing::MakeMatcher;
|
|
|
|
using testing::MatcherInterface;
|
|
|
|
using testing::MatchResultListener;
|
|
|
|
using testing::StringMatchResultListener;
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
namespace compiler {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
template <typename T>
|
2015-04-23 09:04:37 +00:00
|
|
|
bool PrintMatchAndExplain(const T& value, const std::string& value_name,
|
2014-10-20 11:26:23 +00:00
|
|
|
const Matcher<T>& value_matcher,
|
|
|
|
MatchResultListener* listener) {
|
|
|
|
StringMatchResultListener value_listener;
|
|
|
|
if (!value_matcher.MatchAndExplain(value, &value_listener)) {
|
|
|
|
*listener << "whose " << value_name << " " << value << " doesn't match";
|
|
|
|
if (value_listener.str() != "") {
|
|
|
|
*listener << ", " << value_listener.str();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class NodeMatcher : public MatcherInterface<Node*> {
|
|
|
|
public:
|
|
|
|
explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const override {
|
2014-10-20 11:26:23 +00:00
|
|
|
*os << "is a " << IrOpcode::Mnemonic(opcode_) << " node";
|
|
|
|
}
|
|
|
|
|
2014-12-22 13:47:54 +00:00
|
|
|
bool MatchAndExplain(Node* node,
|
2015-04-20 13:08:11 +00:00
|
|
|
MatchResultListener* listener) const override {
|
2014-10-20 11:26:23 +00:00
|
|
|
if (node == NULL) {
|
|
|
|
*listener << "which is NULL";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (node->opcode() != opcode_) {
|
|
|
|
*listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode())
|
|
|
|
<< " but should have been " << IrOpcode::Mnemonic(opcode_);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const IrOpcode::Value opcode_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsBranchMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsBranchMatcher(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kBranch),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"value", value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> value_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsSwitchMatcher final : public NodeMatcher {
|
2015-02-17 13:29:31 +00:00
|
|
|
public:
|
|
|
|
IsSwitchMatcher(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kSwitch),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2015-02-17 13:29:31 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2015-02-17 13:29:31 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"value", value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> value_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsIfValueMatcher final : public NodeMatcher {
|
2015-02-17 13:29:31 +00:00
|
|
|
public:
|
|
|
|
IsIfValueMatcher(const Matcher<int32_t>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kIfValue),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2015-02-17 13:29:31 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2015-02-17 13:29:31 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<int32_t>(node->op()), "value",
|
|
|
|
value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<int32_t> value_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsControl1Matcher final : public NodeMatcher {
|
2015-01-20 09:45:02 +00:00
|
|
|
public:
|
|
|
|
IsControl1Matcher(IrOpcode::Value opcode,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(opcode), control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2015-01-20 09:45:02 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2015-01-20 09:45:02 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsControl2Matcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
2015-01-20 09:45:02 +00:00
|
|
|
IsControl2Matcher(IrOpcode::Value opcode,
|
|
|
|
const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher)
|
|
|
|
: NodeMatcher(opcode),
|
2014-10-20 11:26:23 +00:00
|
|
|
control0_matcher_(control0_matcher),
|
|
|
|
control1_matcher_(control1_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose control0 (";
|
|
|
|
control0_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control1 (";
|
|
|
|
control1_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0),
|
|
|
|
"control0", control0_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1),
|
|
|
|
"control1", control1_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> control0_matcher_;
|
|
|
|
const Matcher<Node*> control1_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsControl3Matcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
2015-01-20 09:45:02 +00:00
|
|
|
IsControl3Matcher(IrOpcode::Value opcode,
|
|
|
|
const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher,
|
|
|
|
const Matcher<Node*>& control2_matcher)
|
|
|
|
: NodeMatcher(opcode),
|
|
|
|
control0_matcher_(control0_matcher),
|
|
|
|
control1_matcher_(control1_matcher),
|
|
|
|
control2_matcher_(control2_matcher) {}
|
2014-10-20 11:26:23 +00:00
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
2015-01-20 09:45:02 +00:00
|
|
|
*os << " whose control0 (";
|
|
|
|
control0_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control1 (";
|
|
|
|
control1_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control2 (";
|
|
|
|
control2_matcher_.DescribeTo(os);
|
2014-10-20 11:26:23 +00:00
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
2015-01-20 09:45:02 +00:00
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0),
|
|
|
|
"control0", control0_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1),
|
|
|
|
"control1", control1_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 2),
|
|
|
|
"control2", control2_matcher_, listener));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2015-01-20 09:45:02 +00:00
|
|
|
const Matcher<Node*> control0_matcher_;
|
|
|
|
const Matcher<Node*> control1_matcher_;
|
|
|
|
const Matcher<Node*> control2_matcher_;
|
2014-10-20 11:26:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsFinishMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsFinishMatcher(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kFinish),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
effect_matcher_(effect_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"value", value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> value_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsReturnMatcher final : public NodeMatcher {
|
2015-01-20 09:45:02 +00:00
|
|
|
public:
|
|
|
|
IsReturnMatcher(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kReturn),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2015-01-20 09:45:02 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2015-01-20 09:45:02 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"value", value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> value_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-05-06 12:51:41 +00:00
|
|
|
class IsTerminateMatcher final : public NodeMatcher {
|
|
|
|
public:
|
|
|
|
IsTerminateMatcher(const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kTerminate),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
|
|
|
void DescribeTo(std::ostream* os) const final {
|
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
template <typename T>
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsConstantMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher)
|
|
|
|
: NodeMatcher(opcode), value_matcher_(value_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_,
|
|
|
|
listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<T> value_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsSelectMatcher final : public NodeMatcher {
|
2014-10-29 14:16:32 +00:00
|
|
|
public:
|
|
|
|
IsSelectMatcher(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kSelect),
|
|
|
|
type_matcher_(type_matcher),
|
|
|
|
value0_matcher_(value0_matcher),
|
|
|
|
value1_matcher_(value1_matcher),
|
|
|
|
value2_matcher_(value2_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-29 14:16:32 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose type (";
|
|
|
|
type_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value0 (";
|
|
|
|
value0_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value1 (";
|
|
|
|
value1_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and value2 (";
|
|
|
|
value2_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-29 14:16:32 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
|
|
|
|
type_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"value0", value0_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"value1", value1_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
|
|
|
"value2", value2_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<MachineType> type_matcher_;
|
|
|
|
const Matcher<Node*> value0_matcher_;
|
|
|
|
const Matcher<Node*> value1_matcher_;
|
|
|
|
const Matcher<Node*> value2_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsPhiMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsPhiMatcher(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kPhi),
|
|
|
|
type_matcher_(type_matcher),
|
|
|
|
value0_matcher_(value0_matcher),
|
|
|
|
value1_matcher_(value1_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose type (";
|
|
|
|
type_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value0 (";
|
|
|
|
value0_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value1 (";
|
|
|
|
value1_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
|
|
|
|
type_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"value0", value0_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"value1", value1_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<MachineType> type_matcher_;
|
|
|
|
const Matcher<Node*> value0_matcher_;
|
|
|
|
const Matcher<Node*> value1_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsPhi2Matcher final : public NodeMatcher {
|
2015-01-20 09:45:02 +00:00
|
|
|
public:
|
|
|
|
IsPhi2Matcher(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kPhi),
|
|
|
|
type_matcher_(type_matcher),
|
|
|
|
value0_matcher_(value0_matcher),
|
|
|
|
value1_matcher_(value1_matcher),
|
|
|
|
value2_matcher_(value2_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2015-01-20 09:45:02 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose type (";
|
|
|
|
type_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value0 (";
|
|
|
|
value0_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value1 (";
|
|
|
|
value1_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value2 (";
|
|
|
|
value2_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2015-01-20 09:45:02 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
|
|
|
|
type_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"value0", value0_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"value1", value1_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
|
|
|
"value2", value2_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<MachineType> type_matcher_;
|
|
|
|
const Matcher<Node*> value0_matcher_;
|
|
|
|
const Matcher<Node*> value1_matcher_;
|
|
|
|
const Matcher<Node*> value2_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsEffectPhiMatcher final : public NodeMatcher {
|
2014-11-04 14:37:22 +00:00
|
|
|
public:
|
|
|
|
IsEffectPhiMatcher(const Matcher<Node*>& effect0_matcher,
|
|
|
|
const Matcher<Node*>& effect1_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kEffectPhi),
|
|
|
|
effect0_matcher_(effect0_matcher),
|
|
|
|
effect1_matcher_(effect1_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-11-04 14:37:22 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << "), effect0 (";
|
|
|
|
effect0_matcher_.DescribeTo(os);
|
|
|
|
*os << "), effect1 (";
|
|
|
|
effect1_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-11-04 14:37:22 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0),
|
|
|
|
"effect0", effect0_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1),
|
|
|
|
"effect1", effect1_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> effect0_matcher_;
|
|
|
|
const Matcher<Node*> effect1_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsEffectSetMatcher final : public NodeMatcher {
|
2015-01-27 14:02:21 +00:00
|
|
|
public:
|
|
|
|
IsEffectSetMatcher(const Matcher<Node*>& effect0_matcher,
|
|
|
|
const Matcher<Node*>& effect1_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kEffectSet),
|
|
|
|
effect0_matcher_(effect0_matcher),
|
|
|
|
effect1_matcher_(effect1_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2015-01-27 14:02:21 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << "), effect0 (";
|
|
|
|
effect0_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and effect1 (";
|
|
|
|
effect1_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2015-03-19 15:44:29 +00:00
|
|
|
if (!NodeMatcher::MatchAndExplain(node, listener)) return false;
|
|
|
|
|
|
|
|
Node* effect0 = NodeProperties::GetEffectInput(node, 0);
|
|
|
|
Node* effect1 = NodeProperties::GetEffectInput(node, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
// Try matching in the reverse order first.
|
|
|
|
StringMatchResultListener value_listener;
|
|
|
|
if (effect0_matcher_.MatchAndExplain(effect1, &value_listener) &&
|
|
|
|
effect1_matcher_.MatchAndExplain(effect0, &value_listener)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return PrintMatchAndExplain(effect0, "effect0", effect0_matcher_,
|
|
|
|
listener) &&
|
|
|
|
PrintMatchAndExplain(effect1, "effect1", effect1_matcher_, listener);
|
2015-01-27 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> effect0_matcher_;
|
|
|
|
const Matcher<Node*> effect1_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsProjectionMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsProjectionMatcher(const Matcher<size_t>& index_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kProjection),
|
|
|
|
index_matcher_(index_matcher),
|
|
|
|
base_matcher_(base_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose index (";
|
|
|
|
index_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and base (";
|
|
|
|
base_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<size_t>(node), "index",
|
|
|
|
index_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<size_t> index_matcher_;
|
|
|
|
const Matcher<Node*> base_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-23 09:04:37 +00:00
|
|
|
class IsCallMatcher final : public NodeMatcher {
|
2014-11-04 12:58:17 +00:00
|
|
|
public:
|
2015-04-23 09:04:37 +00:00
|
|
|
IsCallMatcher(const Matcher<CallDescriptor*>& descriptor_matcher,
|
|
|
|
const std::vector<Matcher<Node*>>& value_matchers,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
2014-10-20 11:26:23 +00:00
|
|
|
: NodeMatcher(IrOpcode::kCall),
|
|
|
|
descriptor_matcher_(descriptor_matcher),
|
2015-04-23 09:04:37 +00:00
|
|
|
value_matchers_(value_matchers),
|
2014-10-20 11:26:23 +00:00
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
2015-04-23 09:04:37 +00:00
|
|
|
for (size_t i = 0; i < value_matchers_.size(); ++i) {
|
|
|
|
if (i == 0) {
|
|
|
|
*os << " whose value0 (";
|
|
|
|
} else {
|
|
|
|
*os << "), value" << i << " (";
|
|
|
|
}
|
|
|
|
value_matchers_[i].DescribeTo(os);
|
|
|
|
}
|
|
|
|
*os << "), effect (";
|
2014-10-20 11:26:23 +00:00
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2015-04-23 09:04:37 +00:00
|
|
|
if (!NodeMatcher::MatchAndExplain(node, listener) ||
|
|
|
|
!PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), "descriptor",
|
|
|
|
descriptor_matcher_, listener)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (size_t i = 0; i < value_matchers_.size(); ++i) {
|
|
|
|
std::ostringstream ost;
|
|
|
|
ost << "value" << i;
|
|
|
|
if (!PrintMatchAndExplain(
|
|
|
|
NodeProperties::GetValueInput(node, static_cast<int>(i)),
|
|
|
|
ost.str(), value_matchers_[i], listener)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
2014-10-20 11:26:23 +00:00
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<CallDescriptor*> descriptor_matcher_;
|
2015-04-23 09:04:37 +00:00
|
|
|
const std::vector<Matcher<Node*>> value_matchers_;
|
2014-10-20 11:26:23 +00:00
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-05-05 09:42:59 +00:00
|
|
|
class IsTailCallMatcher final : public NodeMatcher {
|
|
|
|
public:
|
|
|
|
IsTailCallMatcher(const Matcher<CallDescriptor const*>& descriptor_matcher,
|
|
|
|
const std::vector<Matcher<Node*>>& value_matchers,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kTailCall),
|
|
|
|
descriptor_matcher_(descriptor_matcher),
|
|
|
|
value_matchers_(value_matchers),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
|
|
|
void DescribeTo(std::ostream* os) const final {
|
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
for (size_t i = 0; i < value_matchers_.size(); ++i) {
|
|
|
|
if (i == 0) {
|
|
|
|
*os << " whose value0 (";
|
|
|
|
} else {
|
|
|
|
*os << "), value" << i << " (";
|
|
|
|
}
|
|
|
|
value_matchers_[i].DescribeTo(os);
|
|
|
|
}
|
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
|
|
|
if (!NodeMatcher::MatchAndExplain(node, listener) ||
|
|
|
|
!PrintMatchAndExplain(OpParameter<CallDescriptor const*>(node),
|
|
|
|
"descriptor", descriptor_matcher_, listener)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (size_t i = 0; i < value_matchers_.size(); ++i) {
|
|
|
|
std::ostringstream ost;
|
|
|
|
ost << "value" << i;
|
|
|
|
if (!PrintMatchAndExplain(
|
|
|
|
NodeProperties::GetValueInput(node, static_cast<int>(i)),
|
|
|
|
ost.str(), value_matchers_[i], listener)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<CallDescriptor const*> descriptor_matcher_;
|
|
|
|
const std::vector<Matcher<Node*>> value_matchers_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-05-27 04:23:29 +00:00
|
|
|
class IsReferenceEqualMatcher final : public NodeMatcher {
|
|
|
|
public:
|
|
|
|
IsReferenceEqualMatcher(const Matcher<Type*>& type_matcher,
|
|
|
|
const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kReferenceEqual),
|
|
|
|
type_matcher_(type_matcher),
|
|
|
|
lhs_matcher_(lhs_matcher),
|
|
|
|
rhs_matcher_(rhs_matcher) {}
|
|
|
|
|
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
// TODO(bmeurer): The type parameter is currently ignored.
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs",
|
|
|
|
lhs_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs",
|
|
|
|
rhs_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Type*> type_matcher_;
|
|
|
|
const Matcher<Node*> lhs_matcher_;
|
|
|
|
const Matcher<Node*> rhs_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-05-04 12:07:12 +00:00
|
|
|
class IsAllocateMatcher final : public NodeMatcher {
|
|
|
|
public:
|
|
|
|
IsAllocateMatcher(const Matcher<Node*>& size_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kAllocate),
|
|
|
|
size_matcher_(size_matcher),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "size",
|
|
|
|
size_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> size_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsLoadFieldMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
2014-10-28 08:33:52 +00:00
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
2014-10-20 11:26:23 +00:00
|
|
|
: NodeMatcher(IrOpcode::kLoadField),
|
|
|
|
access_matcher_(access_matcher),
|
|
|
|
base_matcher_(base_matcher),
|
2014-10-28 08:33:52 +00:00
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
2014-10-20 11:26:23 +00:00
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose access (";
|
|
|
|
access_matcher_.DescribeTo(os);
|
|
|
|
*os << "), base (";
|
|
|
|
base_matcher_.DescribeTo(os);
|
2014-10-28 08:33:52 +00:00
|
|
|
*os << "), effect (";
|
2014-10-20 11:26:23 +00:00
|
|
|
effect_matcher_.DescribeTo(os);
|
2014-10-28 08:33:52 +00:00
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
2014-10-20 11:26:23 +00:00
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access",
|
|
|
|
access_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
2014-10-28 08:33:52 +00:00
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<FieldAccess> access_matcher_;
|
|
|
|
const Matcher<Node*> base_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
2014-10-28 08:33:52 +00:00
|
|
|
const Matcher<Node*> control_matcher_;
|
2014-10-20 11:26:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsStoreFieldMatcher final : public NodeMatcher {
|
2014-12-04 10:50:43 +00:00
|
|
|
public:
|
|
|
|
IsStoreFieldMatcher(const Matcher<FieldAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kStoreField),
|
|
|
|
access_matcher_(access_matcher),
|
|
|
|
base_matcher_(base_matcher),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-12-04 10:50:43 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose access (";
|
|
|
|
access_matcher_.DescribeTo(os);
|
|
|
|
*os << "), base (";
|
|
|
|
base_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-12-04 10:50:43 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access",
|
|
|
|
access_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"value", value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<FieldAccess> access_matcher_;
|
|
|
|
const Matcher<Node*> base_matcher_;
|
|
|
|
const Matcher<Node*> value_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsLoadBufferMatcher final : public NodeMatcher {
|
2014-12-02 04:48:57 +00:00
|
|
|
public:
|
|
|
|
IsLoadBufferMatcher(const Matcher<BufferAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& buffer_matcher,
|
|
|
|
const Matcher<Node*>& offset_matcher,
|
|
|
|
const Matcher<Node*>& length_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kLoadBuffer),
|
|
|
|
access_matcher_(access_matcher),
|
|
|
|
buffer_matcher_(buffer_matcher),
|
|
|
|
offset_matcher_(offset_matcher),
|
|
|
|
length_matcher_(length_matcher),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-12-02 04:48:57 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose access (";
|
|
|
|
access_matcher_.DescribeTo(os);
|
|
|
|
*os << "), buffer (";
|
|
|
|
buffer_matcher_.DescribeTo(os);
|
|
|
|
*os << "), offset (";
|
|
|
|
offset_matcher_.DescribeTo(os);
|
|
|
|
*os << "), length (";
|
|
|
|
length_matcher_.DescribeTo(os);
|
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-12-02 04:48:57 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(BufferAccessOf(node->op()), "access",
|
|
|
|
access_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"buffer", buffer_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"offset", offset_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
|
|
|
"length", length_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<BufferAccess> access_matcher_;
|
|
|
|
const Matcher<Node*> buffer_matcher_;
|
|
|
|
const Matcher<Node*> offset_matcher_;
|
|
|
|
const Matcher<Node*> length_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsStoreBufferMatcher final : public NodeMatcher {
|
2014-12-02 04:48:57 +00:00
|
|
|
public:
|
|
|
|
IsStoreBufferMatcher(const Matcher<BufferAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& buffer_matcher,
|
|
|
|
const Matcher<Node*>& offset_matcher,
|
|
|
|
const Matcher<Node*>& length_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kStoreBuffer),
|
|
|
|
access_matcher_(access_matcher),
|
|
|
|
buffer_matcher_(buffer_matcher),
|
|
|
|
offset_matcher_(offset_matcher),
|
|
|
|
length_matcher_(length_matcher),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-12-02 04:48:57 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose access (";
|
|
|
|
access_matcher_.DescribeTo(os);
|
|
|
|
*os << "), buffer (";
|
|
|
|
buffer_matcher_.DescribeTo(os);
|
|
|
|
*os << "), offset (";
|
|
|
|
offset_matcher_.DescribeTo(os);
|
|
|
|
*os << "), length (";
|
|
|
|
length_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-12-02 04:48:57 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(BufferAccessOf(node->op()), "access",
|
|
|
|
access_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"buffer", buffer_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"offset", offset_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
|
|
|
"length", length_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3),
|
|
|
|
"value", value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<BufferAccess> access_matcher_;
|
|
|
|
const Matcher<Node*> buffer_matcher_;
|
|
|
|
const Matcher<Node*> offset_matcher_;
|
|
|
|
const Matcher<Node*> length_matcher_;
|
|
|
|
const Matcher<Node*> value_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsLoadElementMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
2014-12-02 04:48:57 +00:00
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
2014-10-20 11:26:23 +00:00
|
|
|
: NodeMatcher(IrOpcode::kLoadElement),
|
|
|
|
access_matcher_(access_matcher),
|
|
|
|
base_matcher_(base_matcher),
|
|
|
|
index_matcher_(index_matcher),
|
2014-12-02 04:48:57 +00:00
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
2014-10-20 11:26:23 +00:00
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose access (";
|
|
|
|
access_matcher_.DescribeTo(os);
|
|
|
|
*os << "), base (";
|
|
|
|
base_matcher_.DescribeTo(os);
|
|
|
|
*os << "), index (";
|
|
|
|
index_matcher_.DescribeTo(os);
|
2014-12-02 04:48:57 +00:00
|
|
|
*os << "), effect (";
|
2014-10-20 11:26:23 +00:00
|
|
|
effect_matcher_.DescribeTo(os);
|
2014-12-02 04:48:57 +00:00
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
2014-10-20 11:26:23 +00:00
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access",
|
|
|
|
access_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"index", index_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
2014-12-02 04:48:57 +00:00
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<ElementAccess> access_matcher_;
|
|
|
|
const Matcher<Node*> base_matcher_;
|
|
|
|
const Matcher<Node*> index_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
2014-12-02 04:48:57 +00:00
|
|
|
const Matcher<Node*> control_matcher_;
|
2014-10-20 11:26:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsStoreElementMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsStoreElementMatcher(const Matcher<ElementAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kStoreElement),
|
|
|
|
access_matcher_(access_matcher),
|
|
|
|
base_matcher_(base_matcher),
|
|
|
|
index_matcher_(index_matcher),
|
|
|
|
value_matcher_(value_matcher),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose access (";
|
|
|
|
access_matcher_.DescribeTo(os);
|
|
|
|
*os << "), base (";
|
|
|
|
base_matcher_.DescribeTo(os);
|
|
|
|
*os << "), index (";
|
|
|
|
index_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access",
|
|
|
|
access_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"index", index_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
|
|
|
"value", value_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<ElementAccess> access_matcher_;
|
|
|
|
const Matcher<Node*> base_matcher_;
|
|
|
|
const Matcher<Node*> index_matcher_;
|
|
|
|
const Matcher<Node*> value_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsLoadMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsLoadMatcher(const Matcher<LoadRepresentation>& rep_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kLoad),
|
|
|
|
rep_matcher_(rep_matcher),
|
|
|
|
base_matcher_(base_matcher),
|
|
|
|
index_matcher_(index_matcher),
|
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose rep (";
|
|
|
|
rep_matcher_.DescribeTo(os);
|
|
|
|
*os << "), base (";
|
|
|
|
base_matcher_.DescribeTo(os);
|
|
|
|
*os << "), index (";
|
|
|
|
index_matcher_.DescribeTo(os);
|
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep",
|
|
|
|
rep_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"index", index_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<LoadRepresentation> rep_matcher_;
|
|
|
|
const Matcher<Node*> base_matcher_;
|
|
|
|
const Matcher<Node*> index_matcher_;
|
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-02 09:37:49 +00:00
|
|
|
class IsStoreMatcher final : public NodeMatcher {
|
2014-11-25 08:40:18 +00:00
|
|
|
public:
|
2015-06-02 09:37:49 +00:00
|
|
|
IsStoreMatcher(const Matcher<StoreRepresentation>& rep_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kStore),
|
|
|
|
rep_matcher_(rep_matcher),
|
2014-11-25 08:40:18 +00:00
|
|
|
base_matcher_(base_matcher),
|
2015-06-02 09:37:49 +00:00
|
|
|
index_matcher_(index_matcher),
|
|
|
|
value_matcher_(value_matcher),
|
2014-11-25 08:40:18 +00:00
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-11-25 08:40:18 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
2015-06-02 09:37:49 +00:00
|
|
|
*os << " whose rep (";
|
|
|
|
rep_matcher_.DescribeTo(os);
|
|
|
|
*os << "), base (";
|
2014-11-25 08:40:18 +00:00
|
|
|
base_matcher_.DescribeTo(os);
|
2015-06-02 09:37:49 +00:00
|
|
|
*os << "), index (";
|
|
|
|
index_matcher_.DescribeTo(os);
|
|
|
|
*os << "), value (";
|
|
|
|
value_matcher_.DescribeTo(os);
|
2014-11-25 08:40:18 +00:00
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-11-25 08:40:18 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
2015-06-02 09:37:49 +00:00
|
|
|
PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep",
|
|
|
|
rep_matcher_, listener) &&
|
2014-11-25 08:40:18 +00:00
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener) &&
|
2015-06-02 09:37:49 +00:00
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
|
|
|
"index", index_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
|
|
|
"value", value_matcher_, listener) &&
|
2014-11-25 08:40:18 +00:00
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2015-06-02 09:37:49 +00:00
|
|
|
const Matcher<StoreRepresentation> rep_matcher_;
|
2014-11-25 08:40:18 +00:00
|
|
|
const Matcher<Node*> base_matcher_;
|
2015-06-02 09:37:49 +00:00
|
|
|
const Matcher<Node*> index_matcher_;
|
|
|
|
const Matcher<Node*> value_matcher_;
|
2014-11-25 08:40:18 +00:00
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-02 09:37:49 +00:00
|
|
|
class IsToNumberMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
2015-06-02 09:37:49 +00:00
|
|
|
IsToNumberMatcher(const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& context_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kJSToNumber),
|
2014-10-20 11:26:23 +00:00
|
|
|
base_matcher_(base_matcher),
|
2015-06-02 09:37:49 +00:00
|
|
|
context_matcher_(context_matcher),
|
2014-10-20 11:26:23 +00:00
|
|
|
effect_matcher_(effect_matcher),
|
|
|
|
control_matcher_(control_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
2015-06-02 09:37:49 +00:00
|
|
|
*os << " whose base (";
|
2014-10-20 11:26:23 +00:00
|
|
|
base_matcher_.DescribeTo(os);
|
2015-06-02 09:37:49 +00:00
|
|
|
*os << "), context (";
|
|
|
|
context_matcher_.DescribeTo(os);
|
2014-10-20 11:26:23 +00:00
|
|
|
*os << "), effect (";
|
|
|
|
effect_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and control (";
|
|
|
|
control_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
|
|
|
|
base_matcher_, listener) &&
|
2015-06-02 09:37:49 +00:00
|
|
|
PrintMatchAndExplain(NodeProperties::GetContextInput(node),
|
|
|
|
"context", context_matcher_, listener) &&
|
2014-10-20 11:26:23 +00:00
|
|
|
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
|
|
|
effect_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
|
|
|
"control", control_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> base_matcher_;
|
2015-06-02 09:37:49 +00:00
|
|
|
const Matcher<Node*> context_matcher_;
|
2014-10-20 11:26:23 +00:00
|
|
|
const Matcher<Node*> effect_matcher_;
|
|
|
|
const Matcher<Node*> control_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-02 09:37:49 +00:00
|
|
|
class IsLoadContextMatcher final : public NodeMatcher {
|
|
|
|
public:
|
|
|
|
IsLoadContextMatcher(const Matcher<ContextAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& context_matcher)
|
|
|
|
: NodeMatcher(IrOpcode::kJSLoadContext),
|
|
|
|
access_matcher_(access_matcher),
|
|
|
|
context_matcher_(context_matcher) {}
|
|
|
|
|
2015-06-08 08:59:00 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose access (";
|
|
|
|
access_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and context (";
|
|
|
|
context_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-06-02 09:37:49 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(OpParameter<ContextAccess>(node), "access",
|
|
|
|
access_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetContextInput(node),
|
|
|
|
"context", context_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<ContextAccess> access_matcher_;
|
|
|
|
const Matcher<Node*> context_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsBinopMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher)
|
|
|
|
: NodeMatcher(opcode),
|
|
|
|
lhs_matcher_(lhs_matcher),
|
|
|
|
rhs_matcher_(rhs_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose lhs (";
|
|
|
|
lhs_matcher_.DescribeTo(os);
|
|
|
|
*os << ") and rhs (";
|
|
|
|
rhs_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs",
|
|
|
|
lhs_matcher_, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs",
|
|
|
|
rhs_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> lhs_matcher_;
|
|
|
|
const Matcher<Node*> rhs_matcher_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class IsUnopMatcher final : public NodeMatcher {
|
2014-10-20 11:26:23 +00:00
|
|
|
public:
|
|
|
|
IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher)
|
|
|
|
: NodeMatcher(opcode), input_matcher_(input_matcher) {}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
void DescribeTo(std::ostream* os) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
NodeMatcher::DescribeTo(os);
|
|
|
|
*os << " whose input (";
|
|
|
|
input_matcher_.DescribeTo(os);
|
|
|
|
*os << ")";
|
|
|
|
}
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
2014-10-20 11:26:23 +00:00
|
|
|
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
|
|
|
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
|
|
|
"input", input_matcher_, listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Matcher<Node*> input_matcher_;
|
|
|
|
};
|
2015-01-27 14:02:21 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
2015-05-26 10:31:55 +00:00
|
|
|
Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) {
|
|
|
|
return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher) {
|
|
|
|
return MakeMatcher(new IsControl2Matcher(IrOpcode::kEnd, control0_matcher,
|
|
|
|
control1_matcher));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsBranchMatcher(value_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher) {
|
2015-01-20 09:45:02 +00:00
|
|
|
return MakeMatcher(new IsControl2Matcher(IrOpcode::kMerge, control0_matcher,
|
|
|
|
control1_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-17 13:29:31 +00:00
|
|
|
Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher,
|
|
|
|
const Matcher<Node*>& control2_matcher) {
|
|
|
|
return MakeMatcher(new IsControl3Matcher(IrOpcode::kMerge, control0_matcher,
|
|
|
|
control1_matcher, control2_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-20 09:45:02 +00:00
|
|
|
Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher) {
|
|
|
|
return MakeMatcher(new IsControl2Matcher(IrOpcode::kLoop, control0_matcher,
|
|
|
|
control1_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsLoop(const Matcher<Node*>& control0_matcher,
|
|
|
|
const Matcher<Node*>& control1_matcher,
|
|
|
|
const Matcher<Node*>& control2_matcher) {
|
|
|
|
return MakeMatcher(new IsControl3Matcher(IrOpcode::kLoop, control0_matcher,
|
|
|
|
control1_matcher, control2_matcher));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsControl1Matcher(IrOpcode::kIfTrue, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsControl1Matcher(IrOpcode::kIfFalse, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-03 06:11:37 +00:00
|
|
|
Matcher<Node*> IsIfSuccess(const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsControl1Matcher(IrOpcode::kIfSuccess, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-17 13:29:31 +00:00
|
|
|
Matcher<Node*> IsSwitch(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsSwitchMatcher(value_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsIfValue(const Matcher<int32_t>& value_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsIfValueMatcher(value_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsIfDefault(const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsControl1Matcher(IrOpcode::kIfDefault, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher) {
|
|
|
|
return MakeMatcher(new IsUnopMatcher(IrOpcode::kValueEffect, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher) {
|
|
|
|
return MakeMatcher(new IsFinishMatcher(value_matcher, effect_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-20 09:45:02 +00:00
|
|
|
Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsReturnMatcher(value_matcher, effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-06 12:51:41 +00:00
|
|
|
Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsTerminateMatcher(effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsExternalConstant(
|
|
|
|
const Matcher<ExternalReference>& value_matcher) {
|
|
|
|
return MakeMatcher(new IsConstantMatcher<ExternalReference>(
|
|
|
|
IrOpcode::kExternalConstant, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsHeapConstant(
|
|
|
|
const Matcher<Unique<HeapObject> >& value_matcher) {
|
|
|
|
return MakeMatcher(new IsConstantMatcher<Unique<HeapObject> >(
|
|
|
|
IrOpcode::kHeapConstant, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsConstantMatcher<int32_t>(IrOpcode::kInt32Constant, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsConstantMatcher<int64_t>(IrOpcode::kInt64Constant, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsFloat32Constant(const Matcher<float>& value_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsConstantMatcher<float>(IrOpcode::kFloat32Constant, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsConstantMatcher<double>(IrOpcode::kFloat64Constant, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsConstantMatcher<double>(IrOpcode::kNumberConstant, value_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-29 14:16:32 +00:00
|
|
|
Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher) {
|
|
|
|
return MakeMatcher(new IsSelectMatcher(type_matcher, value0_matcher,
|
|
|
|
value1_matcher, value2_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& merge_matcher) {
|
|
|
|
return MakeMatcher(new IsPhiMatcher(type_matcher, value0_matcher,
|
|
|
|
value1_matcher, merge_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-20 09:45:02 +00:00
|
|
|
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher,
|
|
|
|
const Matcher<Node*>& merge_matcher) {
|
|
|
|
return MakeMatcher(new IsPhi2Matcher(type_matcher, value0_matcher,
|
|
|
|
value1_matcher, value2_matcher,
|
|
|
|
merge_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-04 14:37:22 +00:00
|
|
|
Matcher<Node*> IsEffectPhi(const Matcher<Node*>& effect0_matcher,
|
|
|
|
const Matcher<Node*>& effect1_matcher,
|
|
|
|
const Matcher<Node*>& merge_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsEffectPhiMatcher(effect0_matcher, effect1_matcher, merge_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-27 14:02:21 +00:00
|
|
|
Matcher<Node*> IsEffectSet(const Matcher<Node*>& effect0_matcher,
|
|
|
|
const Matcher<Node*>& effect1_matcher) {
|
|
|
|
return MakeMatcher(new IsEffectSetMatcher(effect0_matcher, effect1_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher) {
|
|
|
|
return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-04 12:58:17 +00:00
|
|
|
Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
2015-04-23 09:04:37 +00:00
|
|
|
std::vector<Matcher<Node*>> value_matchers;
|
|
|
|
value_matchers.push_back(value0_matcher);
|
|
|
|
value_matchers.push_back(value1_matcher);
|
|
|
|
return MakeMatcher(new IsCallMatcher(descriptor_matcher, value_matchers,
|
|
|
|
effect_matcher, control_matcher));
|
2014-11-04 12:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher,
|
|
|
|
const Matcher<Node*>& value3_matcher,
|
2015-04-23 09:04:37 +00:00
|
|
|
const Matcher<Node*>& value4_matcher,
|
2014-10-20 11:26:23 +00:00
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
2015-04-23 09:04:37 +00:00
|
|
|
std::vector<Matcher<Node*>> value_matchers;
|
|
|
|
value_matchers.push_back(value0_matcher);
|
|
|
|
value_matchers.push_back(value1_matcher);
|
|
|
|
value_matchers.push_back(value2_matcher);
|
|
|
|
value_matchers.push_back(value3_matcher);
|
|
|
|
value_matchers.push_back(value4_matcher);
|
|
|
|
return MakeMatcher(new IsCallMatcher(descriptor_matcher, value_matchers,
|
|
|
|
effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher,
|
|
|
|
const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher,
|
|
|
|
const Matcher<Node*>& value3_matcher,
|
|
|
|
const Matcher<Node*>& value4_matcher,
|
|
|
|
const Matcher<Node*>& value5_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
std::vector<Matcher<Node*>> value_matchers;
|
|
|
|
value_matchers.push_back(value0_matcher);
|
|
|
|
value_matchers.push_back(value1_matcher);
|
|
|
|
value_matchers.push_back(value2_matcher);
|
|
|
|
value_matchers.push_back(value3_matcher);
|
|
|
|
value_matchers.push_back(value4_matcher);
|
|
|
|
value_matchers.push_back(value5_matcher);
|
|
|
|
return MakeMatcher(new IsCallMatcher(descriptor_matcher, value_matchers,
|
|
|
|
effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsCall(
|
|
|
|
const Matcher<CallDescriptor*>& descriptor_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& value2_matcher, const Matcher<Node*>& value3_matcher,
|
|
|
|
const Matcher<Node*>& value4_matcher, const Matcher<Node*>& value5_matcher,
|
|
|
|
const Matcher<Node*>& value6_matcher, const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
std::vector<Matcher<Node*>> value_matchers;
|
|
|
|
value_matchers.push_back(value0_matcher);
|
|
|
|
value_matchers.push_back(value1_matcher);
|
|
|
|
value_matchers.push_back(value2_matcher);
|
|
|
|
value_matchers.push_back(value3_matcher);
|
|
|
|
value_matchers.push_back(value4_matcher);
|
|
|
|
value_matchers.push_back(value5_matcher);
|
|
|
|
value_matchers.push_back(value6_matcher);
|
|
|
|
return MakeMatcher(new IsCallMatcher(descriptor_matcher, value_matchers,
|
|
|
|
effect_matcher, control_matcher));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-05 09:42:59 +00:00
|
|
|
Matcher<Node*> IsTailCall(
|
|
|
|
const Matcher<CallDescriptor const*>& descriptor_matcher,
|
|
|
|
const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
std::vector<Matcher<Node*>> value_matchers;
|
|
|
|
value_matchers.push_back(value0_matcher);
|
|
|
|
value_matchers.push_back(value1_matcher);
|
|
|
|
return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers,
|
|
|
|
effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-27 04:23:29 +00:00
|
|
|
Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher,
|
|
|
|
const Matcher<Node*>& lhs_matcher,
|
|
|
|
const Matcher<Node*>& rhs_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-04 12:07:12 +00:00
|
|
|
Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(
|
|
|
|
new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
2014-10-28 08:33:52 +00:00
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher,
|
|
|
|
effect_matcher, control_matcher));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-04 10:50:43 +00:00
|
|
|
Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsStoreFieldMatcher(access_matcher, base_matcher,
|
|
|
|
value_matcher, effect_matcher,
|
|
|
|
control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-02 04:48:57 +00:00
|
|
|
Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& buffer_matcher,
|
|
|
|
const Matcher<Node*>& offset_matcher,
|
|
|
|
const Matcher<Node*>& length_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsLoadBufferMatcher(access_matcher, buffer_matcher,
|
|
|
|
offset_matcher, length_matcher,
|
|
|
|
effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsStoreBuffer(const Matcher<BufferAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& buffer_matcher,
|
|
|
|
const Matcher<Node*>& offset_matcher,
|
|
|
|
const Matcher<Node*>& length_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsStoreBufferMatcher(
|
|
|
|
access_matcher, buffer_matcher, offset_matcher, length_matcher,
|
|
|
|
value_matcher, effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
2014-12-02 04:48:57 +00:00
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
2014-10-20 11:26:23 +00:00
|
|
|
return MakeMatcher(new IsLoadElementMatcher(access_matcher, base_matcher,
|
2014-12-02 04:48:57 +00:00
|
|
|
index_matcher, effect_matcher,
|
|
|
|
control_matcher));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsStoreElementMatcher(
|
2014-12-02 04:48:57 +00:00
|
|
|
access_matcher, base_matcher, index_matcher, value_matcher,
|
|
|
|
effect_matcher, control_matcher));
|
2014-10-20 11:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsLoadMatcher(rep_matcher, base_matcher, index_matcher,
|
|
|
|
effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
|
|
|
|
const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& index_matcher,
|
|
|
|
const Matcher<Node*>& value_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsStoreMatcher(rep_matcher, base_matcher,
|
|
|
|
index_matcher, value_matcher,
|
|
|
|
effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-02 09:37:49 +00:00
|
|
|
Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher,
|
|
|
|
const Matcher<Node*>& context_matcher,
|
|
|
|
const Matcher<Node*>& effect_matcher,
|
|
|
|
const Matcher<Node*>& control_matcher) {
|
|
|
|
return MakeMatcher(new IsToNumberMatcher(base_matcher, context_matcher,
|
|
|
|
effect_matcher, control_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher,
|
|
|
|
const Matcher<Node*>& context_matcher) {
|
|
|
|
return MakeMatcher(new IsLoadContextMatcher(access_matcher, context_matcher));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-20 11:26:23 +00:00
|
|
|
#define IS_BINOP_MATCHER(Name) \
|
|
|
|
Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
|
|
|
|
const Matcher<Node*>& rhs_matcher) { \
|
|
|
|
return MakeMatcher( \
|
|
|
|
new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \
|
|
|
|
}
|
2014-10-28 08:33:52 +00:00
|
|
|
IS_BINOP_MATCHER(NumberEqual)
|
2014-10-20 11:26:23 +00:00
|
|
|
IS_BINOP_MATCHER(NumberLessThan)
|
|
|
|
IS_BINOP_MATCHER(NumberSubtract)
|
2014-10-29 14:16:32 +00:00
|
|
|
IS_BINOP_MATCHER(NumberMultiply)
|
2014-10-20 11:26:23 +00:00
|
|
|
IS_BINOP_MATCHER(Word32And)
|
|
|
|
IS_BINOP_MATCHER(Word32Sar)
|
|
|
|
IS_BINOP_MATCHER(Word32Shl)
|
|
|
|
IS_BINOP_MATCHER(Word32Shr)
|
|
|
|
IS_BINOP_MATCHER(Word32Ror)
|
|
|
|
IS_BINOP_MATCHER(Word32Equal)
|
|
|
|
IS_BINOP_MATCHER(Word64And)
|
|
|
|
IS_BINOP_MATCHER(Word64Sar)
|
|
|
|
IS_BINOP_MATCHER(Word64Shl)
|
|
|
|
IS_BINOP_MATCHER(Word64Equal)
|
|
|
|
IS_BINOP_MATCHER(Int32AddWithOverflow)
|
|
|
|
IS_BINOP_MATCHER(Int32Add)
|
|
|
|
IS_BINOP_MATCHER(Int32Sub)
|
|
|
|
IS_BINOP_MATCHER(Int32Mul)
|
|
|
|
IS_BINOP_MATCHER(Int32MulHigh)
|
|
|
|
IS_BINOP_MATCHER(Int32LessThan)
|
|
|
|
IS_BINOP_MATCHER(Uint32LessThan)
|
|
|
|
IS_BINOP_MATCHER(Uint32LessThanOrEqual)
|
2015-04-08 11:54:53 +00:00
|
|
|
IS_BINOP_MATCHER(Float32Max)
|
|
|
|
IS_BINOP_MATCHER(Float32Min)
|
2015-03-12 14:07:28 +00:00
|
|
|
IS_BINOP_MATCHER(Float64Max)
|
|
|
|
IS_BINOP_MATCHER(Float64Min)
|
2014-11-06 06:13:10 +00:00
|
|
|
IS_BINOP_MATCHER(Float64Sub)
|
2015-03-05 09:22:26 +00:00
|
|
|
IS_BINOP_MATCHER(Float64InsertLowWord32)
|
|
|
|
IS_BINOP_MATCHER(Float64InsertHighWord32)
|
2014-10-20 11:26:23 +00:00
|
|
|
#undef IS_BINOP_MATCHER
|
|
|
|
|
|
|
|
|
|
|
|
#define IS_UNOP_MATCHER(Name) \
|
|
|
|
Matcher<Node*> Is##Name(const Matcher<Node*>& input_matcher) { \
|
|
|
|
return MakeMatcher(new IsUnopMatcher(IrOpcode::k##Name, input_matcher)); \
|
|
|
|
}
|
2014-10-28 08:33:52 +00:00
|
|
|
IS_UNOP_MATCHER(BooleanNot)
|
2014-10-20 11:26:23 +00:00
|
|
|
IS_UNOP_MATCHER(ChangeFloat64ToInt32)
|
|
|
|
IS_UNOP_MATCHER(ChangeFloat64ToUint32)
|
|
|
|
IS_UNOP_MATCHER(ChangeInt32ToFloat64)
|
|
|
|
IS_UNOP_MATCHER(ChangeInt32ToInt64)
|
|
|
|
IS_UNOP_MATCHER(ChangeUint32ToFloat64)
|
|
|
|
IS_UNOP_MATCHER(ChangeUint32ToUint64)
|
|
|
|
IS_UNOP_MATCHER(TruncateFloat64ToFloat32)
|
|
|
|
IS_UNOP_MATCHER(TruncateFloat64ToInt32)
|
|
|
|
IS_UNOP_MATCHER(TruncateInt64ToInt32)
|
2015-04-08 11:54:53 +00:00
|
|
|
IS_UNOP_MATCHER(Float32Abs)
|
|
|
|
IS_UNOP_MATCHER(Float64Abs)
|
2014-10-20 11:26:23 +00:00
|
|
|
IS_UNOP_MATCHER(Float64Sqrt)
|
2015-03-10 08:42:47 +00:00
|
|
|
IS_UNOP_MATCHER(Float64RoundDown)
|
Add floor, ceil, round (truncate) instructions for ia32, x64 (if SSE4.1) and
add floor, ceil, round (truncate and away from zero) for arm64.
R=bmeurer@chromium.org, dcarney@chromium.org, mstarzinger@chromium.org, rodolph.perfetta@arm.com
TEST=test/mjsunit/asm/math-floor.js,test/mjsunit/asm/math-ceil.js,test/unittest/compiler/js-builtin-reducer-unittest.cc
Review URL: https://codereview.chromium.org/677433002
Cr-Commit-Position: refs/heads/master@{#25018}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25018 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-30 14:15:20 +00:00
|
|
|
IS_UNOP_MATCHER(Float64RoundTruncate)
|
|
|
|
IS_UNOP_MATCHER(Float64RoundTiesAway)
|
2015-03-05 09:22:26 +00:00
|
|
|
IS_UNOP_MATCHER(Float64ExtractLowWord32)
|
|
|
|
IS_UNOP_MATCHER(Float64ExtractHighWord32)
|
2014-11-25 08:40:18 +00:00
|
|
|
IS_UNOP_MATCHER(NumberToInt32)
|
|
|
|
IS_UNOP_MATCHER(NumberToUint32)
|
2015-01-26 09:05:47 +00:00
|
|
|
IS_UNOP_MATCHER(ObjectIsSmi)
|
|
|
|
IS_UNOP_MATCHER(ObjectIsNonNegativeSmi)
|
2015-03-20 08:37:20 +00:00
|
|
|
IS_UNOP_MATCHER(Word32Clz)
|
2014-10-20 11:26:23 +00:00
|
|
|
#undef IS_UNOP_MATCHER
|
|
|
|
|
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|