OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ |
| 6 #define V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ |
| 7 |
| 8 #include "src/compiler/common-operator.h" |
| 9 #include "src/compiler/graph-builder.h" |
| 10 #include "src/compiler/machine-node-factory.h" |
| 11 #include "src/compiler/machine-operator.h" |
| 12 #include "src/compiler/simplified-node-factory.h" |
| 13 #include "src/compiler/simplified-operator.h" |
| 14 #include "test/cctest/cctest.h" |
| 15 #include "test/cctest/compiler/call-tester.h" |
| 16 |
| 17 namespace v8 { |
| 18 namespace internal { |
| 19 namespace compiler { |
| 20 |
| 21 class SimplifiedGraphBuilder |
| 22 : public StructuredGraphBuilder, |
| 23 public MachineNodeFactory<SimplifiedGraphBuilder>, |
| 24 public SimplifiedNodeFactory<SimplifiedGraphBuilder> { |
| 25 public: |
| 26 SimplifiedGraphBuilder(Graph* graph, CommonOperatorBuilder* common, |
| 27 MachineOperatorBuilder* machine, |
| 28 SimplifiedOperatorBuilder* simplified); |
| 29 virtual ~SimplifiedGraphBuilder() {} |
| 30 |
| 31 class Environment : public StructuredGraphBuilder::Environment { |
| 32 public: |
| 33 Environment(SimplifiedGraphBuilder* builder, Node* control_dependency); |
| 34 |
| 35 // TODO(dcarney): encode somehow and merge into StructuredGraphBuilder. |
| 36 // SSA renaming operations. |
| 37 Node* Top(); |
| 38 void Push(Node* node); |
| 39 Node* Pop(); |
| 40 void Poke(size_t depth, Node* node); |
| 41 Node* Peek(size_t depth); |
| 42 }; |
| 43 |
| 44 Isolate* isolate() const { return zone()->isolate(); } |
| 45 Zone* zone() const { return StructuredGraphBuilder::zone(); } |
| 46 CommonOperatorBuilder* common() const { |
| 47 return StructuredGraphBuilder::common(); |
| 48 } |
| 49 MachineOperatorBuilder* machine() const { return machine_; } |
| 50 SimplifiedOperatorBuilder* simplified() const { return simplified_; } |
| 51 Environment* environment() { |
| 52 return reinterpret_cast<Environment*>(environment_internal()); |
| 53 } |
| 54 |
| 55 // Initialize graph and builder. |
| 56 void Begin(); |
| 57 |
| 58 void Return(Node* value); |
| 59 |
| 60 // Close the graph. |
| 61 void End(); |
| 62 |
| 63 private: |
| 64 MachineOperatorBuilder* machine_; |
| 65 SimplifiedOperatorBuilder* simplified_; |
| 66 }; |
| 67 |
| 68 } // namespace compiler |
| 69 } // namespace internal |
| 70 } // namespace v8 |
| 71 |
| 72 #endif // V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ |
OLD | NEW |