Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: pkg/compiler/lib/src/ssa/graph_builder.dart

Issue 2280743003: implement kernel -> ssa for function that returns a constant (Closed)
Patch Set: add todo Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/ssa/graph_builder.dart
diff --git a/pkg/compiler/lib/src/ssa/graph_builder.dart b/pkg/compiler/lib/src/ssa/graph_builder.dart
index 969899f617e6e1032d0ca4031d2e56906a95b95d..1c4c68973faa4310e27fda94835ffcc5c83a6cf5 100644
--- a/pkg/compiler/lib/src/ssa/graph_builder.dart
+++ b/pkg/compiler/lib/src/ssa/graph_builder.dart
@@ -14,6 +14,25 @@ abstract class GraphBuilder {
/// Holds the resulting SSA graph.
final HGraph graph = new HGraph();
+ /// A stack of instructions.
+ ///
+ /// We build the SSA graph by simulating a stack machine.
+ List<HInstruction> stack = <HInstruction>[];
+
+
+ void push(HInstruction instruction) {
+ add(instruction);
+ stack.add(instruction);
+ }
+
+ HInstruction pop() {
+ return stack.removeLast();
+ }
+
+ void dup() {
+ stack.add(stack.last);
+ }
+
HBasicBlock _current;
/// The current block to add instructions to. Might be null, if we are
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | tests/compiler/dart2js/kernel/simple_function_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698