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

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

Issue 1858283002: Initial SIMDBC interpreter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_dbc.cc » ('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 // Class for intrinsifying functions. 4 // Class for intrinsifying functions.
5 5
6 #include "vm/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 // Setup all dart:developer lib functions that can be intrinsified. 113 // Setup all dart:developer lib functions that can be intrinsified.
114 lib = Library::DeveloperLibrary(); 114 lib = Library::DeveloperLibrary();
115 ASSERT(!lib.IsNull()); 115 ASSERT(!lib.IsNull());
116 DEVELOPER_LIB_INTRINSIC_LIST(SETUP_FUNCTION); 116 DEVELOPER_LIB_INTRINSIC_LIST(SETUP_FUNCTION);
117 117
118 #undef SETUP_FUNCTION 118 #undef SETUP_FUNCTION
119 } 119 }
120 #endif // defined(DART_NO_SNAPSHOT). 120 #endif // defined(DART_NO_SNAPSHOT).
121 121
122
123 // DBC does not use graph intrinsics.
124 #if !defined(TARGET_ARCH_DBC)
122 static void EmitCodeFor(FlowGraphCompiler* compiler, 125 static void EmitCodeFor(FlowGraphCompiler* compiler,
123 FlowGraph* graph) { 126 FlowGraph* graph) {
124 // The FlowGraph here is constructed by the intrinsics builder methods, and 127 // The FlowGraph here is constructed by the intrinsics builder methods, and
125 // is different from compiler->flow_graph(), the original method's flow graph. 128 // is different from compiler->flow_graph(), the original method's flow graph.
126 compiler->assembler()->Comment("Graph intrinsic begin"); 129 compiler->assembler()->Comment("Graph intrinsic begin");
127 for (intptr_t i = 0; i < graph->reverse_postorder().length(); i++) { 130 for (intptr_t i = 0; i < graph->reverse_postorder().length(); i++) {
128 BlockEntryInstr* block = graph->reverse_postorder()[i]; 131 BlockEntryInstr* block = graph->reverse_postorder()[i];
129 if (block->IsGraphEntry()) continue; // No code for graph entry needed. 132 if (block->IsGraphEntry()) continue; // No code for graph entry needed.
130 133
131 if (block->HasParallelMove()) { 134 if (block->HasParallelMove()) {
(...skipping 15 matching lines...) Expand all
147 } else { 150 } else {
148 ASSERT(instr->locs() != NULL); 151 ASSERT(instr->locs() != NULL);
149 // Calls are not supported in intrinsics code. 152 // Calls are not supported in intrinsics code.
150 ASSERT(!instr->locs()->always_calls()); 153 ASSERT(!instr->locs()->always_calls());
151 instr->EmitNativeCode(compiler); 154 instr->EmitNativeCode(compiler);
152 } 155 }
153 } 156 }
154 } 157 }
155 compiler->assembler()->Comment("Graph intrinsic end"); 158 compiler->assembler()->Comment("Graph intrinsic end");
156 } 159 }
160 #endif
157 161
158 162
159 bool Intrinsifier::GraphIntrinsify(const ParsedFunction& parsed_function, 163 bool Intrinsifier::GraphIntrinsify(const ParsedFunction& parsed_function,
160 FlowGraphCompiler* compiler) { 164 FlowGraphCompiler* compiler) {
165 #if !defined(TARGET_ARCH_DBC)
161 ZoneGrowableArray<const ICData*>* ic_data_array = 166 ZoneGrowableArray<const ICData*>* ic_data_array =
162 new ZoneGrowableArray<const ICData*>(); 167 new ZoneGrowableArray<const ICData*>();
163 FlowGraphBuilder builder(parsed_function, 168 FlowGraphBuilder builder(parsed_function,
164 *ic_data_array, 169 *ic_data_array,
165 NULL, // NULL = not inlining. 170 NULL, // NULL = not inlining.
166 Compiler::kNoOSRDeoptId); 171 Compiler::kNoOSRDeoptId);
167 172
168 intptr_t block_id = builder.AllocateBlockId(); 173 intptr_t block_id = builder.AllocateBlockId();
169 TargetEntryInstr* normal_entry = 174 TargetEntryInstr* normal_entry =
170 new TargetEntryInstr(block_id, 175 new TargetEntryInstr(block_id,
(...skipping 26 matching lines...) Expand all
197 allocator.AllocateRegisters(); 202 allocator.AllocateRegisters();
198 203
199 if (FLAG_support_il_printer && 204 if (FLAG_support_il_printer &&
200 FLAG_print_flow_graph && FlowGraphPrinter::ShouldPrint(function)) { 205 FLAG_print_flow_graph && FlowGraphPrinter::ShouldPrint(function)) {
201 THR_Print("Intrinsic graph after\n"); 206 THR_Print("Intrinsic graph after\n");
202 FlowGraphPrinter printer(*graph); 207 FlowGraphPrinter printer(*graph);
203 printer.PrintBlocks(); 208 printer.PrintBlocks();
204 } 209 }
205 EmitCodeFor(compiler, graph); 210 EmitCodeFor(compiler, graph);
206 return true; 211 return true;
212 #else
213 return false;
214 #endif // !defined(TARGET_ARCH_DBC)
207 } 215 }
208 216
209 217
210 void Intrinsifier::Intrinsify(const ParsedFunction& parsed_function, 218 void Intrinsifier::Intrinsify(const ParsedFunction& parsed_function,
211 FlowGraphCompiler* compiler) { 219 FlowGraphCompiler* compiler) {
212 const Function& function = parsed_function.function(); 220 const Function& function = parsed_function.function();
213 if (!CanIntrinsify(function)) { 221 if (!CanIntrinsify(function)) {
214 return; 222 return;
215 } 223 }
216 224
(...skipping 11 matching lines...) Expand all
228 switch (function.recognized_kind()) { 236 switch (function.recognized_kind()) {
229 ALL_INTRINSICS_NO_INTEGER_LIB_LIST(EMIT_CASE); 237 ALL_INTRINSICS_NO_INTEGER_LIB_LIST(EMIT_CASE);
230 default: 238 default:
231 break; 239 break;
232 } 240 }
233 switch (function.recognized_kind()) { 241 switch (function.recognized_kind()) {
234 CORE_INTEGER_LIB_INTRINSIC_LIST(EMIT_CASE) 242 CORE_INTEGER_LIB_INTRINSIC_LIST(EMIT_CASE)
235 default: 243 default:
236 break; 244 break;
237 } 245 }
246
247 // On DBC all graph intrinsics are handled in the same way as non-graph
248 // intrinsics.
249 #if defined(TARGET_ARCH_DBC)
250 switch (function.recognized_kind()) {
251 GRAPH_INTRINSICS_LIST(EMIT_CASE)
252 default:
253 break;
254 }
255 #endif
256
238 #undef EMIT_INTRINSIC 257 #undef EMIT_INTRINSIC
239 } 258 }
240 259
241 260
261 #if !defined(TARGET_ARCH_DBC)
242 static intptr_t CidForRepresentation(Representation rep) { 262 static intptr_t CidForRepresentation(Representation rep) {
243 switch (rep) { 263 switch (rep) {
244 case kUnboxedDouble: 264 case kUnboxedDouble:
245 return kDoubleCid; 265 return kDoubleCid;
246 case kUnboxedFloat32x4: 266 case kUnboxedFloat32x4:
247 return kFloat32x4Cid; 267 return kFloat32x4Cid;
248 case kUnboxedUint32: 268 case kUnboxedUint32:
249 return kDynamicCid; // smi or mint. 269 return kDynamicCid; // smi or mint.
250 default: 270 default:
251 UNREACHABLE(); 271 UNREACHABLE();
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 bool Intrinsifier::Build_DoubleRound(FlowGraph* flow_graph) { 1151 bool Intrinsifier::Build_DoubleRound(FlowGraph* flow_graph) {
1132 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; 1152 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false;
1133 1153
1134 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); 1154 GraphEntryInstr* graph_entry = flow_graph->graph_entry();
1135 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); 1155 TargetEntryInstr* normal_entry = graph_entry->normal_entry();
1136 BlockBuilder builder(flow_graph, normal_entry); 1156 BlockBuilder builder(flow_graph, normal_entry);
1137 1157
1138 return BuildInvokeMathCFunction(&builder, 1158 return BuildInvokeMathCFunction(&builder,
1139 MethodRecognizer::kDoubleRound); 1159 MethodRecognizer::kDoubleRound);
1140 } 1160 }
1161 #endif // !defined(TARGET_ARCH_DBC)
1162
1141 1163
1142 } // namespace dart 1164 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698