Commit 501f250c authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[turbofan] [cleanup] remove UnalignedLoadRepresentation

UnalignedLoad is the only kind of load operation that defines its own
UnalignedLoadRepresentation type alias and LoadRepresentationOf function.
This is a problem because it means we cannot use the LOAD_MATCHER
infrastructure without defining all of this boilerplate for all the other
kinds of load operations. Since these aliases serve no real purpose,
it is best to unify UnalignedLoad to how its peers are handled.

Change-Id: I51a591eb82fb85edee66512136b23276e851f767
Reviewed-on: https://chromium-review.googlesource.com/951683
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51802}
parent 6af30f41
......@@ -569,7 +569,7 @@ void InstructionSelector::VisitProtectedStore(Node* node) {
void InstructionSelector::VisitUnalignedLoad(Node* node) {
MachineRepresentation load_rep =
UnalignedLoadRepresentationOf(node->op()).representation();
LoadRepresentationOf(node->op()).representation();
ArmOperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
......
......@@ -1519,8 +1519,7 @@ void InstructionSelector::VisitNode(Node* node) {
case IrOpcode::kLoadParentFramePointer:
return VisitLoadParentFramePointer(node);
case IrOpcode::kUnalignedLoad: {
UnalignedLoadRepresentation type =
UnalignedLoadRepresentationOf(node->op());
LoadRepresentation type = LoadRepresentationOf(node->op());
MarkAsRepresentation(type.representation(), node);
return VisitUnalignedLoad(node);
}
......
......@@ -164,7 +164,7 @@ void Int64Lowering::LowerNode(Node* node) {
rep = LoadRepresentationOf(node->op()).representation();
} else {
DCHECK_EQ(IrOpcode::kUnalignedLoad, node->opcode());
rep = UnalignedLoadRepresentationOf(node->op()).representation();
rep = LoadRepresentationOf(node->op()).representation();
}
if (rep == MachineRepresentation::kWord64) {
......
......@@ -125,7 +125,7 @@ class MachineRepresentationInferrer {
break;
case IrOpcode::kUnalignedLoad:
representation_vector_[node->id()] = PromoteRepresentation(
UnalignedLoadRepresentationOf(node->op()).representation());
LoadRepresentationOf(node->op()).representation());
break;
case IrOpcode::kPhi:
representation_vector_[node->id()] =
......
......@@ -38,7 +38,8 @@ LoadRepresentation LoadRepresentationOf(Operator const* op) {
DCHECK(IrOpcode::kLoad == op->opcode() ||
IrOpcode::kProtectedLoad == op->opcode() ||
IrOpcode::kWord32AtomicLoad == op->opcode() ||
IrOpcode::kPoisonedLoad == op->opcode());
IrOpcode::kPoisonedLoad == op->opcode() ||
IrOpcode::kUnalignedLoad == op->opcode());
return OpParameter<LoadRepresentation>(op);
}
......@@ -49,11 +50,6 @@ StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
return OpParameter<StoreRepresentation>(op);
}
UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kUnalignedLoad, op->opcode());
return OpParameter<UnalignedLoadRepresentation>(op);
}
UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
Operator const* op) {
DCHECK_EQ(IrOpcode::kUnalignedStore, op->opcode());
......@@ -476,9 +472,9 @@ struct MachineOperatorGlobalCache {
"PoisonedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
}; \
struct UnalignedLoad##Type##Operator final \
: public Operator1<UnalignedLoadRepresentation> { \
: public Operator1<LoadRepresentation> { \
UnalignedLoad##Type##Operator() \
: Operator1<UnalignedLoadRepresentation>( \
: Operator1<LoadRepresentation>( \
IrOpcode::kUnalignedLoad, \
Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \
"UnalignedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
......@@ -722,8 +718,7 @@ MachineOperatorBuilder::MachineOperatorBuilder(
word == MachineRepresentation::kWord64);
}
const Operator* MachineOperatorBuilder::UnalignedLoad(
UnalignedLoadRepresentation rep) {
const Operator* MachineOperatorBuilder::UnalignedLoad(LoadRepresentation rep) {
#define LOAD(Type) \
if (rep == MachineType::Type()) { \
return &cache_.kUnalignedLoad##Type; \
......
......@@ -73,10 +73,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, StoreRepresentation);
StoreRepresentation const& StoreRepresentationOf(Operator const*);
typedef MachineType UnalignedLoadRepresentation;
UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const*);
// An UnalignedStore needs a MachineType.
typedef MachineRepresentation UnalignedStoreRepresentation;
......@@ -592,7 +588,7 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final
const Operator* ProtectedStore(MachineRepresentation rep);
// unaligned load [base + index]
const Operator* UnalignedLoad(UnalignedLoadRepresentation rep);
const Operator* UnalignedLoad(LoadRepresentation rep);
// unaligned store [base + index], value
const Operator* UnalignedStore(UnalignedStoreRepresentation rep);
......
......@@ -1235,8 +1235,7 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; }
void InstructionSelector::VisitUnalignedLoad(Node* node) {
UnalignedLoadRepresentation load_rep =
UnalignedLoadRepresentationOf(node->op());
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
MipsOperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
......
......@@ -1725,8 +1725,7 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; }
void InstructionSelector::VisitUnalignedLoad(Node* node) {
UnalignedLoadRepresentation load_rep =
UnalignedLoadRepresentationOf(node->op());
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
Mips64OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
......@@ -1963,8 +1962,7 @@ bool IsNodeUnsigned(Node* n) {
LoadRepresentation load_rep = LoadRepresentationOf(n->op());
return load_rep.IsUnsigned();
} else if (m.IsUnalignedLoad()) {
UnalignedLoadRepresentation load_rep =
UnalignedLoadRepresentationOf(n->op());
LoadRepresentation load_rep = LoadRepresentationOf(n->op());
return load_rep.IsUnsigned();
} else {
return m.IsUint32Div() || m.IsUint32LessThan() ||
......
......@@ -784,7 +784,7 @@ void SimdScalarLowering::LowerNode(Node* node) {
}
case IrOpcode::kUnalignedLoad: {
MachineRepresentation rep =
UnalignedLoadRepresentationOf(node->op()).representation();
LoadRepresentationOf(node->op()).representation();
const Operator* load_op;
load_op = machine()->UnalignedLoad(MachineTypeFrom(rep_type));
LowerLoadOp(rep, node, load_op, rep_type);
......
......@@ -1059,7 +1059,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher {
#define LOAD_MATCHER(kLoad) \
class Is##kLoad##Matcher final : public TestNodeMatcher { \
public: \
Is##kLoad##Matcher(const Matcher<kLoad##Representation>& rep_matcher, \
Is##kLoad##Matcher(const Matcher<LoadRepresentation>& rep_matcher, \
const Matcher<Node*>& base_matcher, \
const Matcher<Node*>& index_matcher, \
const Matcher<Node*>& effect_matcher, \
......@@ -1098,7 +1098,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher {
} \
return ( \
TestNodeMatcher::MatchAndExplain(node, listener) && \
PrintMatchAndExplain(OpParameter<kLoad##Representation>(node->op()), \
PrintMatchAndExplain(OpParameter<LoadRepresentation>(node->op()), \
"rep", rep_matcher_, listener) && \
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", \
base_matcher_, listener) && \
......@@ -1111,7 +1111,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher {
} \
\
private: \
const Matcher<kLoad##Representation> rep_matcher_; \
const Matcher<LoadRepresentation> rep_matcher_; \
const Matcher<Node*> base_matcher_; \
const Matcher<Node*> index_matcher_; \
const Matcher<Node*> effect_matcher_; \
......@@ -1972,11 +1972,11 @@ Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
effect_matcher, control_matcher));
}
Matcher<Node*> IsUnalignedLoad(
const Matcher<UnalignedLoadRepresentation>& rep_matcher,
const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher) {
Matcher<Node*> IsUnalignedLoad(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 IsUnalignedLoadMatcher(rep_matcher, base_matcher,
index_matcher, effect_matcher,
control_matcher));
......
......@@ -320,11 +320,11 @@ Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
const Matcher<Node*>& index_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
Matcher<Node*> IsUnalignedLoad(
const Matcher<UnalignedLoadRepresentation>& rep_matcher,
const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
Matcher<Node*> IsUnalignedLoad(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);
Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment