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

Side by Side Diff: runtime/vm/flow_graph.cc

Issue 215363004: Support for multiple register values (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_allocator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph.h" 5 #include "vm/flow_graph.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 InsertAfter(next->previous(), instr, env, use_kind); 108 InsertAfter(next->previous(), instr, env, use_kind);
109 } 109 }
110 110
111 111
112 void FlowGraph::InsertAfter(Instruction* prev, 112 void FlowGraph::InsertAfter(Instruction* prev,
113 Instruction* instr, 113 Instruction* instr,
114 Environment* env, 114 Environment* env,
115 Definition::UseKind use_kind) { 115 Definition::UseKind use_kind) {
116 if (use_kind == Definition::kValue) { 116 if (use_kind == Definition::kValue) {
117 ASSERT(instr->IsDefinition()); 117 ASSERT(instr->IsDefinition());
118 instr->AsDefinition()->set_ssa_temp_index(alloc_ssa_temp_index()); 118 AllocateSSAIndexes(instr->AsDefinition());
119 } 119 }
120 instr->InsertAfter(prev); 120 instr->InsertAfter(prev);
121 ASSERT(instr->env() == NULL); 121 ASSERT(instr->env() == NULL);
122 if (env != NULL) env->DeepCopyTo(instr); 122 if (env != NULL) env->DeepCopyTo(instr);
123 } 123 }
124 124
125 125
126 Instruction* FlowGraph::AppendTo(Instruction* prev, 126 Instruction* FlowGraph::AppendTo(Instruction* prev,
127 Instruction* instr, 127 Instruction* instr,
128 Environment* env, 128 Environment* env,
129 Definition::UseKind use_kind) { 129 Definition::UseKind use_kind) {
130 if (use_kind == Definition::kValue) { 130 if (use_kind == Definition::kValue) {
131 ASSERT(instr->IsDefinition()); 131 ASSERT(instr->IsDefinition());
132 instr->AsDefinition()->set_ssa_temp_index(alloc_ssa_temp_index()); 132 AllocateSSAIndexes(instr->AsDefinition());
133 } 133 }
134 ASSERT(instr->env() == NULL); 134 ASSERT(instr->env() == NULL);
135 if (env != NULL) env->DeepCopyTo(instr); 135 if (env != NULL) env->DeepCopyTo(instr);
136 return prev->AppendInstruction(instr); 136 return prev->AppendInstruction(instr);
137 } 137 }
138 138
139 139
140 void FlowGraph::DiscoverBlocks() { 140 void FlowGraph::DiscoverBlocks() {
141 // Initialize state. 141 // Initialize state.
142 preorder_.Clear(); 142 preorder_.Clear();
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // Add global constants to the initial definitions. 709 // Add global constants to the initial definitions.
710 constant_null_ = GetConstant(Object::ZoneHandle()); 710 constant_null_ = GetConstant(Object::ZoneHandle());
711 constant_dead_ = GetConstant(Symbols::OptimizedOut()); 711 constant_dead_ = GetConstant(Symbols::OptimizedOut());
712 712
713 // Add parameters to the initial definitions and renaming environment. 713 // Add parameters to the initial definitions and renaming environment.
714 if (inlining_parameters != NULL) { 714 if (inlining_parameters != NULL) {
715 // Use known parameters. 715 // Use known parameters.
716 ASSERT(parameter_count() == inlining_parameters->length()); 716 ASSERT(parameter_count() == inlining_parameters->length());
717 for (intptr_t i = 0; i < parameter_count(); ++i) { 717 for (intptr_t i = 0; i < parameter_count(); ++i) {
718 Definition* defn = (*inlining_parameters)[i]; 718 Definition* defn = (*inlining_parameters)[i];
719 defn->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. 719 AllocateSSAIndexes(defn);
720 AddToInitialDefinitions(defn); 720 AddToInitialDefinitions(defn);
721 env.Add(defn); 721 env.Add(defn);
722 } 722 }
723 } else { 723 } else {
724 // Create new parameters. For functions compiled for OSR, the locals 724 // Create new parameters. For functions compiled for OSR, the locals
725 // are unknown and so treated like parameters. 725 // are unknown and so treated like parameters.
726 intptr_t count = IsCompiledForOsr() ? variable_count() : parameter_count(); 726 intptr_t count = IsCompiledForOsr() ? variable_count() : parameter_count();
727 for (intptr_t i = 0; i < count; ++i) { 727 for (intptr_t i = 0; i < count; ++i) {
728 ParameterInstr* param = new ParameterInstr(i, entry); 728 ParameterInstr* param = new ParameterInstr(i, entry);
729 param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp. 729 param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 env->Add(result); 919 env->Add(result);
920 // We remove load/store/constant instructions when we find their 920 // We remove load/store/constant instructions when we find their
921 // use in 2a. 921 // use in 2a.
922 } else { 922 } else {
923 it.RemoveCurrentFromGraph(); 923 it.RemoveCurrentFromGraph();
924 } 924 }
925 } else { 925 } else {
926 // Not a load, store, or constant. 926 // Not a load, store, or constant.
927 if (definition->is_used()) { 927 if (definition->is_used()) {
928 // Assign fresh SSA temporary and update expression stack. 928 // Assign fresh SSA temporary and update expression stack.
929 definition->set_ssa_temp_index(alloc_ssa_temp_index()); 929 AllocateSSAIndexes(definition);
930 env->Add(definition); 930 env->Add(definition);
931 } 931 }
932 } 932 }
933 } 933 }
934 934
935 // 2c. Handle pushed argument. 935 // 2c. Handle pushed argument.
936 PushArgumentInstr* push = current->AsPushArgument(); 936 PushArgumentInstr* push = current->AsPushArgument();
937 if (push != NULL) { 937 if (push != NULL) {
938 env->Add(push); 938 env->Add(push);
939 } 939 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 } 1218 }
1219 1219
1220 1220
1221 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, 1221 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from,
1222 BlockEntryInstr* to) const { 1222 BlockEntryInstr* to) const {
1223 return available_at_[to->postorder_number()]->Contains( 1223 return available_at_[to->postorder_number()]->Contains(
1224 from->postorder_number()); 1224 from->postorder_number());
1225 } 1225 }
1226 1226
1227 } // namespace dart 1227 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698