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) { ...@@ -569,7 +569,7 @@ void InstructionSelector::VisitProtectedStore(Node* node) {
void InstructionSelector::VisitUnalignedLoad(Node* node) { void InstructionSelector::VisitUnalignedLoad(Node* node) {
MachineRepresentation load_rep = MachineRepresentation load_rep =
UnalignedLoadRepresentationOf(node->op()).representation(); LoadRepresentationOf(node->op()).representation();
ArmOperandGenerator g(this); ArmOperandGenerator g(this);
Node* base = node->InputAt(0); Node* base = node->InputAt(0);
Node* index = node->InputAt(1); Node* index = node->InputAt(1);
......
...@@ -1519,8 +1519,7 @@ void InstructionSelector::VisitNode(Node* node) { ...@@ -1519,8 +1519,7 @@ void InstructionSelector::VisitNode(Node* node) {
case IrOpcode::kLoadParentFramePointer: case IrOpcode::kLoadParentFramePointer:
return VisitLoadParentFramePointer(node); return VisitLoadParentFramePointer(node);
case IrOpcode::kUnalignedLoad: { case IrOpcode::kUnalignedLoad: {
UnalignedLoadRepresentation type = LoadRepresentation type = LoadRepresentationOf(node->op());
UnalignedLoadRepresentationOf(node->op());
MarkAsRepresentation(type.representation(), node); MarkAsRepresentation(type.representation(), node);
return VisitUnalignedLoad(node); return VisitUnalignedLoad(node);
} }
......
...@@ -164,7 +164,7 @@ void Int64Lowering::LowerNode(Node* node) { ...@@ -164,7 +164,7 @@ void Int64Lowering::LowerNode(Node* node) {
rep = LoadRepresentationOf(node->op()).representation(); rep = LoadRepresentationOf(node->op()).representation();
} else { } else {
DCHECK_EQ(IrOpcode::kUnalignedLoad, node->opcode()); DCHECK_EQ(IrOpcode::kUnalignedLoad, node->opcode());
rep = UnalignedLoadRepresentationOf(node->op()).representation(); rep = LoadRepresentationOf(node->op()).representation();
} }
if (rep == MachineRepresentation::kWord64) { if (rep == MachineRepresentation::kWord64) {
......
...@@ -125,7 +125,7 @@ class MachineRepresentationInferrer { ...@@ -125,7 +125,7 @@ class MachineRepresentationInferrer {
break; break;
case IrOpcode::kUnalignedLoad: case IrOpcode::kUnalignedLoad:
representation_vector_[node->id()] = PromoteRepresentation( representation_vector_[node->id()] = PromoteRepresentation(
UnalignedLoadRepresentationOf(node->op()).representation()); LoadRepresentationOf(node->op()).representation());
break; break;
case IrOpcode::kPhi: case IrOpcode::kPhi:
representation_vector_[node->id()] = representation_vector_[node->id()] =
......
...@@ -38,7 +38,8 @@ LoadRepresentation LoadRepresentationOf(Operator const* op) { ...@@ -38,7 +38,8 @@ LoadRepresentation LoadRepresentationOf(Operator const* op) {
DCHECK(IrOpcode::kLoad == op->opcode() || DCHECK(IrOpcode::kLoad == op->opcode() ||
IrOpcode::kProtectedLoad == op->opcode() || IrOpcode::kProtectedLoad == op->opcode() ||
IrOpcode::kWord32AtomicLoad == op->opcode() || IrOpcode::kWord32AtomicLoad == op->opcode() ||
IrOpcode::kPoisonedLoad == op->opcode()); IrOpcode::kPoisonedLoad == op->opcode() ||
IrOpcode::kUnalignedLoad == op->opcode());
return OpParameter<LoadRepresentation>(op); return OpParameter<LoadRepresentation>(op);
} }
...@@ -49,11 +50,6 @@ StoreRepresentation const& StoreRepresentationOf(Operator const* op) { ...@@ -49,11 +50,6 @@ StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
return OpParameter<StoreRepresentation>(op); return OpParameter<StoreRepresentation>(op);
} }
UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const* op) {
DCHECK_EQ(IrOpcode::kUnalignedLoad, op->opcode());
return OpParameter<UnalignedLoadRepresentation>(op);
}
UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf( UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
Operator const* op) { Operator const* op) {
DCHECK_EQ(IrOpcode::kUnalignedStore, op->opcode()); DCHECK_EQ(IrOpcode::kUnalignedStore, op->opcode());
...@@ -476,9 +472,9 @@ struct MachineOperatorGlobalCache { ...@@ -476,9 +472,9 @@ struct MachineOperatorGlobalCache {
"PoisonedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ "PoisonedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
}; \ }; \
struct UnalignedLoad##Type##Operator final \ struct UnalignedLoad##Type##Operator final \
: public Operator1<UnalignedLoadRepresentation> { \ : public Operator1<LoadRepresentation> { \
UnalignedLoad##Type##Operator() \ UnalignedLoad##Type##Operator() \
: Operator1<UnalignedLoadRepresentation>( \ : Operator1<LoadRepresentation>( \
IrOpcode::kUnalignedLoad, \ IrOpcode::kUnalignedLoad, \
Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \
"UnalignedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ "UnalignedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
...@@ -722,8 +718,7 @@ MachineOperatorBuilder::MachineOperatorBuilder( ...@@ -722,8 +718,7 @@ MachineOperatorBuilder::MachineOperatorBuilder(
word == MachineRepresentation::kWord64); word == MachineRepresentation::kWord64);
} }
const Operator* MachineOperatorBuilder::UnalignedLoad( const Operator* MachineOperatorBuilder::UnalignedLoad(LoadRepresentation rep) {
UnalignedLoadRepresentation rep) {
#define LOAD(Type) \ #define LOAD(Type) \
if (rep == MachineType::Type()) { \ if (rep == MachineType::Type()) { \
return &cache_.kUnalignedLoad##Type; \ return &cache_.kUnalignedLoad##Type; \
......
...@@ -73,10 +73,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, StoreRepresentation); ...@@ -73,10 +73,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, StoreRepresentation);
StoreRepresentation const& StoreRepresentationOf(Operator const*); StoreRepresentation const& StoreRepresentationOf(Operator const*);
typedef MachineType UnalignedLoadRepresentation;
UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const*);
// An UnalignedStore needs a MachineType. // An UnalignedStore needs a MachineType.
typedef MachineRepresentation UnalignedStoreRepresentation; typedef MachineRepresentation UnalignedStoreRepresentation;
...@@ -592,7 +588,7 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final ...@@ -592,7 +588,7 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final
const Operator* ProtectedStore(MachineRepresentation rep); const Operator* ProtectedStore(MachineRepresentation rep);
// unaligned load [base + index] // unaligned load [base + index]
const Operator* UnalignedLoad(UnalignedLoadRepresentation rep); const Operator* UnalignedLoad(LoadRepresentation rep);
// unaligned store [base + index], value // unaligned store [base + index], value
const Operator* UnalignedStore(UnalignedStoreRepresentation rep); const Operator* UnalignedStore(UnalignedStoreRepresentation rep);
......
...@@ -1235,8 +1235,7 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; } ...@@ -1235,8 +1235,7 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; } int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; }
void InstructionSelector::VisitUnalignedLoad(Node* node) { void InstructionSelector::VisitUnalignedLoad(Node* node) {
UnalignedLoadRepresentation load_rep = LoadRepresentation load_rep = LoadRepresentationOf(node->op());
UnalignedLoadRepresentationOf(node->op());
MipsOperandGenerator g(this); MipsOperandGenerator g(this);
Node* base = node->InputAt(0); Node* base = node->InputAt(0);
Node* index = node->InputAt(1); Node* index = node->InputAt(1);
......
...@@ -1725,8 +1725,7 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; } ...@@ -1725,8 +1725,7 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; } int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; }
void InstructionSelector::VisitUnalignedLoad(Node* node) { void InstructionSelector::VisitUnalignedLoad(Node* node) {
UnalignedLoadRepresentation load_rep = LoadRepresentation load_rep = LoadRepresentationOf(node->op());
UnalignedLoadRepresentationOf(node->op());
Mips64OperandGenerator g(this); Mips64OperandGenerator g(this);
Node* base = node->InputAt(0); Node* base = node->InputAt(0);
Node* index = node->InputAt(1); Node* index = node->InputAt(1);
...@@ -1963,8 +1962,7 @@ bool IsNodeUnsigned(Node* n) { ...@@ -1963,8 +1962,7 @@ bool IsNodeUnsigned(Node* n) {
LoadRepresentation load_rep = LoadRepresentationOf(n->op()); LoadRepresentation load_rep = LoadRepresentationOf(n->op());
return load_rep.IsUnsigned(); return load_rep.IsUnsigned();
} else if (m.IsUnalignedLoad()) { } else if (m.IsUnalignedLoad()) {
UnalignedLoadRepresentation load_rep = LoadRepresentation load_rep = LoadRepresentationOf(n->op());
UnalignedLoadRepresentationOf(n->op());
return load_rep.IsUnsigned(); return load_rep.IsUnsigned();
} else { } else {
return m.IsUint32Div() || m.IsUint32LessThan() || return m.IsUint32Div() || m.IsUint32LessThan() ||
......
...@@ -784,7 +784,7 @@ void SimdScalarLowering::LowerNode(Node* node) { ...@@ -784,7 +784,7 @@ void SimdScalarLowering::LowerNode(Node* node) {
} }
case IrOpcode::kUnalignedLoad: { case IrOpcode::kUnalignedLoad: {
MachineRepresentation rep = MachineRepresentation rep =
UnalignedLoadRepresentationOf(node->op()).representation(); LoadRepresentationOf(node->op()).representation();
const Operator* load_op; const Operator* load_op;
load_op = machine()->UnalignedLoad(MachineTypeFrom(rep_type)); load_op = machine()->UnalignedLoad(MachineTypeFrom(rep_type));
LowerLoadOp(rep, node, load_op, rep_type); LowerLoadOp(rep, node, load_op, rep_type);
......
...@@ -1059,7 +1059,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher { ...@@ -1059,7 +1059,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher {
#define LOAD_MATCHER(kLoad) \ #define LOAD_MATCHER(kLoad) \
class Is##kLoad##Matcher final : public TestNodeMatcher { \ class Is##kLoad##Matcher final : public TestNodeMatcher { \
public: \ 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*>& base_matcher, \
const Matcher<Node*>& index_matcher, \ const Matcher<Node*>& index_matcher, \
const Matcher<Node*>& effect_matcher, \ const Matcher<Node*>& effect_matcher, \
...@@ -1098,7 +1098,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher { ...@@ -1098,7 +1098,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher {
} \ } \
return ( \ return ( \
TestNodeMatcher::MatchAndExplain(node, listener) && \ TestNodeMatcher::MatchAndExplain(node, listener) && \
PrintMatchAndExplain(OpParameter<kLoad##Representation>(node->op()), \ PrintMatchAndExplain(OpParameter<LoadRepresentation>(node->op()), \
"rep", rep_matcher_, listener) && \ "rep", rep_matcher_, listener) && \
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", \ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", \
base_matcher_, listener) && \ base_matcher_, listener) && \
...@@ -1111,7 +1111,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher { ...@@ -1111,7 +1111,7 @@ class IsStoreElementMatcher final : public TestNodeMatcher {
} \ } \
\ \
private: \ private: \
const Matcher<kLoad##Representation> rep_matcher_; \ const Matcher<LoadRepresentation> rep_matcher_; \
const Matcher<Node*> base_matcher_; \ const Matcher<Node*> base_matcher_; \
const Matcher<Node*> index_matcher_; \ const Matcher<Node*> index_matcher_; \
const Matcher<Node*> effect_matcher_; \ const Matcher<Node*> effect_matcher_; \
...@@ -1972,11 +1972,11 @@ Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, ...@@ -1972,11 +1972,11 @@ Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
effect_matcher, control_matcher)); effect_matcher, control_matcher));
} }
Matcher<Node*> IsUnalignedLoad( Matcher<Node*> IsUnalignedLoad(const Matcher<LoadRepresentation>& rep_matcher,
const Matcher<UnalignedLoadRepresentation>& rep_matcher, const Matcher<Node*>& base_matcher,
const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher, const Matcher<Node*>& index_matcher,
const Matcher<Node*>& effect_matcher, const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher) { const Matcher<Node*>& control_matcher) {
return MakeMatcher(new IsUnalignedLoadMatcher(rep_matcher, base_matcher, return MakeMatcher(new IsUnalignedLoadMatcher(rep_matcher, base_matcher,
index_matcher, effect_matcher, index_matcher, effect_matcher,
control_matcher)); control_matcher));
......
...@@ -320,11 +320,11 @@ Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, ...@@ -320,11 +320,11 @@ Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
const Matcher<Node*>& index_matcher, const Matcher<Node*>& index_matcher,
const Matcher<Node*>& effect_matcher, const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher); const Matcher<Node*>& control_matcher);
Matcher<Node*> IsUnalignedLoad( Matcher<Node*> IsUnalignedLoad(const Matcher<LoadRepresentation>& rep_matcher,
const Matcher<UnalignedLoadRepresentation>& rep_matcher, const Matcher<Node*>& base_matcher,
const Matcher<Node*>& base_matcher, const Matcher<Node*>& index_matcher, const Matcher<Node*>& index_matcher,
const Matcher<Node*>& effect_matcher, const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher); const Matcher<Node*>& control_matcher);
Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher, Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher,
const Matcher<Node*>& base_matcher, const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_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