| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 5 #ifndef V8_COMPILER_SIMD_SCALAR_LOWERING_H_ |
| 6 #define V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 6 #define V8_COMPILER_SIMD_SCALAR_LOWERING_H_ |
| 7 | 7 |
| 8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 void LowerGraph(); | 24 void LowerGraph(); |
| 25 | 25 |
| 26 int GetParameterCountAfterLowering(); | 26 int GetParameterCountAfterLowering(); |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; | 29 enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; |
| 30 | 30 |
| 31 enum class SimdType : uint8_t { kInt32, kFloat32 }; | 31 enum class SimdType : uint8_t { kInt32, kFloat32 }; |
| 32 | 32 |
| 33 static const int kMaxLanes = 4; | 33 static const int kMaxLanes = 4; |
| 34 static const int kLaneWidth = 16 / kMaxLanes; |
| 34 | 35 |
| 35 struct Replacement { | 36 struct Replacement { |
| 36 Node* node[kMaxLanes]; | 37 Node* node[kMaxLanes]; |
| 37 SimdType type; // represents what input type is expected | 38 SimdType type; // represents what input type is expected |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 Zone* zone() const { return zone_; } | 41 Zone* zone() const { return zone_; } |
| 41 Graph* graph() const { return graph_; } | 42 Graph* graph() const { return graph_; } |
| 42 MachineOperatorBuilder* machine() const { return machine_; } | 43 MachineOperatorBuilder* machine() const { return machine_; } |
| 43 CommonOperatorBuilder* common() const { return common_; } | 44 CommonOperatorBuilder* common() const { return common_; } |
| 44 Signature<MachineRepresentation>* signature() const { return signature_; } | 45 Signature<MachineRepresentation>* signature() const { return signature_; } |
| 45 | 46 |
| 46 void LowerNode(Node* node); | 47 void LowerNode(Node* node); |
| 47 bool DefaultLowering(Node* node); | 48 bool DefaultLowering(Node* node); |
| 48 | 49 |
| 49 void ReplaceNode(Node* old, Node** new_nodes); | 50 void ReplaceNode(Node* old, Node** new_nodes); |
| 50 bool HasReplacement(size_t index, Node* node); | 51 bool HasReplacement(size_t index, Node* node); |
| 51 Node** GetReplacements(Node* node); | 52 Node** GetReplacements(Node* node); |
| 52 Node** GetReplacementsWithType(Node* node, SimdType type); | 53 Node** GetReplacementsWithType(Node* node, SimdType type); |
| 53 SimdType ReplacementType(Node* node); | 54 SimdType ReplacementType(Node* node); |
| 54 void PreparePhiReplacement(Node* phi); | 55 void PreparePhiReplacement(Node* phi); |
| 55 void SetLoweredType(Node* node, Node* output); | 56 void SetLoweredType(Node* node, Node* output); |
| 57 void GetIndexNodes(Node* index, Node** new_indices); |
| 58 void LowerLoadOp(MachineRepresentation rep, Node* node, |
| 59 const Operator* load_op); |
| 60 void LowerStoreOp(MachineRepresentation rep, Node* node, |
| 61 const Operator* store_op, SimdType rep_type); |
| 62 void LowerBinaryOp(Node* node, SimdType rep_type, const Operator* op); |
| 56 | 63 |
| 57 struct NodeState { | 64 struct NodeState { |
| 58 Node* node; | 65 Node* node; |
| 59 int input_index; | 66 int input_index; |
| 60 }; | 67 }; |
| 61 | 68 |
| 62 Zone* zone_; | 69 Zone* zone_; |
| 63 Graph* const graph_; | 70 Graph* const graph_; |
| 64 MachineOperatorBuilder* machine_; | 71 MachineOperatorBuilder* machine_; |
| 65 CommonOperatorBuilder* common_; | 72 CommonOperatorBuilder* common_; |
| 66 NodeMarker<State> state_; | 73 NodeMarker<State> state_; |
| 67 ZoneDeque<NodeState> stack_; | 74 ZoneDeque<NodeState> stack_; |
| 68 Replacement* replacements_; | 75 Replacement* replacements_; |
| 69 Signature<MachineRepresentation>* signature_; | 76 Signature<MachineRepresentation>* signature_; |
| 70 Node* placeholder_; | 77 Node* placeholder_; |
| 71 int parameter_count_after_lowering_; | 78 int parameter_count_after_lowering_; |
| 72 }; | 79 }; |
| 73 | 80 |
| 74 } // namespace compiler | 81 } // namespace compiler |
| 75 } // namespace internal | 82 } // namespace internal |
| 76 } // namespace v8 | 83 } // namespace v8 |
| 77 | 84 |
| 78 #endif // V8_COMPILER_SIMD_SCALAR_LOWERING_H_ | 85 #endif // V8_COMPILER_SIMD_SCALAR_LOWERING_H_ |
| OLD | NEW |