Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 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_INT64_LOWERING_H_ | 5 #ifndef V8_COMPILER_SIMD_SCALAR_LOWERING_H_ |
| 6 #define V8_COMPILER_INT64_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" |
| 11 #include "src/compiler/node-marker.h" | 11 #include "src/compiler/node-marker.h" |
| 12 #include "src/zone-containers.h" | 12 #include "src/zone-containers.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 namespace compiler { | 16 namespace compiler { |
| 17 | 17 |
| 18 class Int64Lowering { | 18 class SimdScalarLowering { |
| 19 public: | 19 public: |
| 20 Int64Lowering(Graph* graph, MachineOperatorBuilder* machine, | 20 SimdScalarLowering(Graph* graph, MachineOperatorBuilder* machine, |
| 21 CommonOperatorBuilder* common, Zone* zone, | 21 CommonOperatorBuilder* common, Zone* zone, |
| 22 Signature<MachineRepresentation>* signature); | 22 Signature<MachineRepresentation>* signature); |
| 23 | 23 |
| 24 void LowerGraph(); | 24 void LowerGraph(); |
| 25 | 25 |
| 26 static int GetParameterCountAfterLowering( | 26 static int GetParameterCountAfterLowering( |
| 27 Signature<MachineRepresentation>* signature); | 27 Signature<MachineRepresentation>* signature); |
| 28 | 28 |
| 29 static const int kLowerWordOffset; | |
| 30 static const int kHigherWordOffset; | |
| 31 | |
| 32 private: | 29 private: |
| 33 enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; | 30 enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; |
| 34 | 31 |
| 32 enum class SimdType : uint8_t { kUndefined, kInt32, kFloat32 }; | |
|
titzer
2016/09/05 12:59:35
I don't see where you are using the kUndefined her
aseemgarg
2016/10/10 17:35:17
Done.
| |
| 33 | |
| 35 struct Replacement { | 34 struct Replacement { |
| 36 Node* low; | 35 Node* node[4]; |
|
bradnelson
2016/08/31 22:42:08
4 -> kMaxLanes?
aseemgarg
2016/10/10 17:35:17
Done.
| |
| 37 Node* high; | 36 SimdType type; // represents what input type is expected |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 Zone* zone() const { return zone_; } | 39 Zone* zone() const { return zone_; } |
| 41 Graph* graph() const { return graph_; } | 40 Graph* graph() const { return graph_; } |
| 42 MachineOperatorBuilder* machine() const { return machine_; } | 41 MachineOperatorBuilder* machine() const { return machine_; } |
| 43 CommonOperatorBuilder* common() const { return common_; } | 42 CommonOperatorBuilder* common() const { return common_; } |
| 44 Signature<MachineRepresentation>* signature() const { return signature_; } | 43 Signature<MachineRepresentation>* signature() const { return signature_; } |
| 45 | 44 |
| 46 void PrepareReplacements(Node* node); | |
| 47 void PushNode(Node* node); | |
| 48 void LowerNode(Node* node); | 45 void LowerNode(Node* node); |
| 49 bool DefaultLowering(Node* node); | 46 bool DefaultLowering(Node* node); |
| 50 void LowerComparison(Node* node, const Operator* signed_op, | |
| 51 const Operator* unsigned_op); | |
| 52 void PrepareProjectionReplacements(Node* node); | |
| 53 | 47 |
| 54 void ReplaceNode(Node* old, Node* new_low, Node* new_high); | 48 void ReplaceNode(Node* old, Node** new_nodes); |
| 55 bool HasReplacementLow(Node* node); | 49 bool HasReplacementLow(Node* node); |
| 56 Node* GetReplacementLow(Node* node); | |
| 57 bool HasReplacementHigh(Node* node); | 50 bool HasReplacementHigh(Node* node); |
| 58 Node* GetReplacementHigh(Node* node); | 51 Node** GetReplacements(Node* node); |
| 52 Node** GetReplacementsWithType(Node* node, SimdType type); | |
| 53 SimdType ReplacementType(Node* node); | |
| 59 void PreparePhiReplacement(Node* phi); | 54 void PreparePhiReplacement(Node* phi); |
| 60 void GetIndexNodes(Node* index, Node*& index_low, Node*& index_high); | 55 void SetType(Node* node, Node* output); |
| 61 | 56 |
| 62 struct NodeState { | 57 struct NodeState { |
| 63 Node* node; | 58 Node* node; |
| 64 int input_index; | 59 int input_index; |
| 65 }; | 60 }; |
| 66 | 61 |
| 67 Zone* zone_; | 62 Zone* zone_; |
| 68 Graph* const graph_; | 63 Graph* const graph_; |
| 69 MachineOperatorBuilder* machine_; | 64 MachineOperatorBuilder* machine_; |
| 70 CommonOperatorBuilder* common_; | 65 CommonOperatorBuilder* common_; |
| 71 NodeMarker<State> state_; | 66 NodeMarker<State> state_; |
| 72 ZoneDeque<NodeState> stack_; | 67 ZoneDeque<NodeState> stack_; |
| 73 Replacement* replacements_; | 68 Replacement* replacements_; |
| 74 Signature<MachineRepresentation>* signature_; | 69 Signature<MachineRepresentation>* signature_; |
| 75 Node* placeholder_; | 70 Node* placeholder_; |
| 76 }; | 71 }; |
| 77 | 72 |
| 78 } // namespace compiler | 73 } // namespace compiler |
| 79 } // namespace internal | 74 } // namespace internal |
| 80 } // namespace v8 | 75 } // namespace v8 |
| 81 | 76 |
| 82 #endif // V8_COMPILER_INT64_LOWERING_H_ | 77 #endif // V8_COMPILER_SIMD_SCALAR_LOWERING_H_ |
| OLD | NEW |