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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 596703004: [turbofan] Add backend support for float32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 3 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 | « src/compiler/representation-change.h ('k') | src/compiler/x64/code-generator-x64.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 2014 the V8 project authors. All rights reserved. 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 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 #include "src/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph-inl.h" 10 #include "src/compiler/graph-inl.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 ProcessInput(node, iter.index(), values > 0 ? use : 0); 281 ProcessInput(node, iter.index(), values > 0 ? use : 0);
282 } 282 }
283 } 283 }
284 // Phis adapt to whatever output representation their uses demand, 284 // Phis adapt to whatever output representation their uses demand,
285 // pushing representation changes to their inputs. 285 // pushing representation changes to their inputs.
286 MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask; 286 MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask;
287 MachineTypeUnion use_type = GetUseInfo(node) & kTypeMask; 287 MachineTypeUnion use_type = GetUseInfo(node) & kTypeMask;
288 MachineTypeUnion rep = 0; 288 MachineTypeUnion rep = 0;
289 if (use_rep & kRepTagged) { 289 if (use_rep & kRepTagged) {
290 rep = kRepTagged; // Tagged overrides everything. 290 rep = kRepTagged; // Tagged overrides everything.
291 } else if (use_rep & kRepFloat32) {
292 rep = kRepFloat32;
291 } else if (use_rep & kRepFloat64) { 293 } else if (use_rep & kRepFloat64) {
292 rep = kRepFloat64; 294 rep = kRepFloat64;
293 } else if (use_rep & kRepWord64) { 295 } else if (use_rep & kRepWord64) {
294 rep = kRepWord64; 296 rep = kRepWord64;
295 } else if (use_rep & kRepWord32) { 297 } else if (use_rep & kRepWord32) {
296 rep = kRepWord32; 298 rep = kRepWord32;
297 } else if (use_rep & kRepBit) { 299 } else if (use_rep & kRepBit) {
298 rep = kRepBit; 300 rep = kRepBit;
299 } else { 301 } else {
300 // There was no representation associated with any of the uses. 302 // There was no representation associated with any of the uses.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 344 }
343 345
344 const Operator* Uint32Op(Node* node) { 346 const Operator* Uint32Op(Node* node) {
345 return changer_->Uint32OperatorFor(node->opcode()); 347 return changer_->Uint32OperatorFor(node->opcode());
346 } 348 }
347 349
348 const Operator* Float64Op(Node* node) { 350 const Operator* Float64Op(Node* node) {
349 return changer_->Float64OperatorFor(node->opcode()); 351 return changer_->Float64OperatorFor(node->opcode());
350 } 352 }
351 353
352 static MachineType AssumeImplicitFloat32Change(MachineType type) {
353 // TODO(titzer): Assume loads of float32 change representation to float64.
354 // Fix this with full support for float32 representations.
355 if (type & kRepFloat32) {
356 return static_cast<MachineType>((type & ~kRepFloat32) | kRepFloat64);
357 }
358 return type;
359 }
360
361 // Dispatching routine for visiting the node {node} with the usage {use}. 354 // Dispatching routine for visiting the node {node} with the usage {use}.
362 // Depending on the operator, propagate new usage info to the inputs. 355 // Depending on the operator, propagate new usage info to the inputs.
363 void VisitNode(Node* node, MachineTypeUnion use, 356 void VisitNode(Node* node, MachineTypeUnion use,
364 SimplifiedLowering* lowering) { 357 SimplifiedLowering* lowering) {
365 switch (node->opcode()) { 358 switch (node->opcode()) {
366 //------------------------------------------------------------------ 359 //------------------------------------------------------------------
367 // Common operators. 360 // Common operators.
368 //------------------------------------------------------------------ 361 //------------------------------------------------------------------
369 case IrOpcode::kStart: 362 case IrOpcode::kStart:
370 case IrOpcode::kDead: 363 case IrOpcode::kDead:
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 565 }
573 case IrOpcode::kStringAdd: { 566 case IrOpcode::kStringAdd: {
574 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); 567 VisitBinop(node, kMachAnyTagged, kMachAnyTagged);
575 if (lower()) lowering->DoStringAdd(node); 568 if (lower()) lowering->DoStringAdd(node);
576 break; 569 break;
577 } 570 }
578 case IrOpcode::kLoadField: { 571 case IrOpcode::kLoadField: {
579 FieldAccess access = FieldAccessOf(node->op()); 572 FieldAccess access = FieldAccessOf(node->op());
580 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); 573 ProcessInput(node, 0, changer_->TypeForBasePointer(access));
581 ProcessRemainingInputs(node, 1); 574 ProcessRemainingInputs(node, 1);
582 SetOutput(node, AssumeImplicitFloat32Change(access.machine_type)); 575 SetOutput(node, access.machine_type);
583 if (lower()) lowering->DoLoadField(node); 576 if (lower()) lowering->DoLoadField(node);
584 break; 577 break;
585 } 578 }
586 case IrOpcode::kStoreField: { 579 case IrOpcode::kStoreField: {
587 FieldAccess access = FieldAccessOf(node->op()); 580 FieldAccess access = FieldAccessOf(node->op());
588 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); 581 ProcessInput(node, 0, changer_->TypeForBasePointer(access));
589 ProcessInput(node, 1, AssumeImplicitFloat32Change(access.machine_type)); 582 ProcessInput(node, 1, access.machine_type);
590 ProcessRemainingInputs(node, 2); 583 ProcessRemainingInputs(node, 2);
591 SetOutput(node, 0); 584 SetOutput(node, 0);
592 if (lower()) lowering->DoStoreField(node); 585 if (lower()) lowering->DoStoreField(node);
593 break; 586 break;
594 } 587 }
595 case IrOpcode::kLoadElement: { 588 case IrOpcode::kLoadElement: {
596 ElementAccess access = ElementAccessOf(node->op()); 589 ElementAccess access = ElementAccessOf(node->op());
597 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); 590 ProcessInput(node, 0, changer_->TypeForBasePointer(access));
598 ProcessInput(node, 1, kMachInt32); // element index 591 ProcessInput(node, 1, kMachInt32); // element index
599 ProcessInput(node, 2, kMachInt32); // length 592 ProcessInput(node, 2, kMachInt32); // length
600 ProcessRemainingInputs(node, 3); 593 ProcessRemainingInputs(node, 3);
601 SetOutput(node, AssumeImplicitFloat32Change(access.machine_type)); 594 SetOutput(node, access.machine_type);
602 if (lower()) lowering->DoLoadElement(node); 595 if (lower()) lowering->DoLoadElement(node);
603 break; 596 break;
604 } 597 }
605 case IrOpcode::kStoreElement: { 598 case IrOpcode::kStoreElement: {
606 ElementAccess access = ElementAccessOf(node->op()); 599 ElementAccess access = ElementAccessOf(node->op());
607 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); 600 ProcessInput(node, 0, changer_->TypeForBasePointer(access));
608 ProcessInput(node, 1, kMachInt32); // element index 601 ProcessInput(node, 1, kMachInt32); // element index
609 ProcessInput(node, 2, kMachInt32); // length 602 ProcessInput(node, 2, kMachInt32); // length
610 ProcessInput(node, 3, AssumeImplicitFloat32Change(access.machine_type)); 603 ProcessInput(node, 3, access.machine_type);
611 ProcessRemainingInputs(node, 4); 604 ProcessRemainingInputs(node, 4);
612 SetOutput(node, 0); 605 SetOutput(node, 0);
613 if (lower()) lowering->DoStoreElement(node); 606 if (lower()) lowering->DoStoreElement(node);
614 break; 607 break;
615 } 608 }
616 609
617 //------------------------------------------------------------------ 610 //------------------------------------------------------------------
618 // Machine-level operators. 611 // Machine-level operators.
619 //------------------------------------------------------------------ 612 //------------------------------------------------------------------
620 case IrOpcode::kLoad: { 613 case IrOpcode::kLoad: {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 return VisitBinop(node, kRepWord64, kRepWord64); 686 return VisitBinop(node, kRepWord64, kRepWord64);
694 case IrOpcode::kWord64Equal: 687 case IrOpcode::kWord64Equal:
695 return VisitBinop(node, kRepWord64, kRepBit); 688 return VisitBinop(node, kRepWord64, kRepBit);
696 689
697 case IrOpcode::kChangeInt32ToInt64: 690 case IrOpcode::kChangeInt32ToInt64:
698 return VisitUnop(node, kTypeInt32 | kRepWord32, 691 return VisitUnop(node, kTypeInt32 | kRepWord32,
699 kTypeInt32 | kRepWord64); 692 kTypeInt32 | kRepWord64);
700 case IrOpcode::kChangeUint32ToUint64: 693 case IrOpcode::kChangeUint32ToUint64:
701 return VisitUnop(node, kTypeUint32 | kRepWord32, 694 return VisitUnop(node, kTypeUint32 | kRepWord32,
702 kTypeUint32 | kRepWord64); 695 kTypeUint32 | kRepWord64);
696 case IrOpcode::kTruncateFloat64ToFloat32:
697 return VisitUnop(node, kTypeNumber | kRepFloat64,
698 kTypeNumber | kRepFloat32);
703 case IrOpcode::kTruncateInt64ToInt32: 699 case IrOpcode::kTruncateInt64ToInt32:
704 // TODO(titzer): Is kTypeInt32 correct here? 700 // TODO(titzer): Is kTypeInt32 correct here?
705 return VisitUnop(node, kTypeInt32 | kRepWord64, 701 return VisitUnop(node, kTypeInt32 | kRepWord64,
706 kTypeInt32 | kRepWord32); 702 kTypeInt32 | kRepWord32);
707 703
704 case IrOpcode::kChangeFloat32ToFloat64:
705 return VisitUnop(node, kTypeNumber | kRepFloat32,
706 kTypeNumber | kRepFloat64);
708 case IrOpcode::kChangeInt32ToFloat64: 707 case IrOpcode::kChangeInt32ToFloat64:
709 return VisitUnop(node, kTypeInt32 | kRepWord32, 708 return VisitUnop(node, kTypeInt32 | kRepWord32,
710 kTypeInt32 | kRepFloat64); 709 kTypeInt32 | kRepFloat64);
711 case IrOpcode::kChangeUint32ToFloat64: 710 case IrOpcode::kChangeUint32ToFloat64:
712 return VisitUnop(node, kTypeUint32 | kRepWord32, 711 return VisitUnop(node, kTypeUint32 | kRepWord32,
713 kTypeUint32 | kRepFloat64); 712 kTypeUint32 | kRepFloat64);
714 case IrOpcode::kChangeFloat64ToInt32: 713 case IrOpcode::kChangeFloat64ToInt32:
715 return VisitUnop(node, kTypeInt32 | kRepFloat64, 714 return VisitUnop(node, kTypeInt32 | kRepFloat64,
716 kTypeInt32 | kRepWord32); 715 kTypeInt32 | kRepWord32);
717 case IrOpcode::kChangeFloat64ToUint32: 716 case IrOpcode::kChangeFloat64ToUint32:
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 935 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
937 node->set_op(machine()->IntLessThanOrEqual()); 936 node->set_op(machine()->IntLessThanOrEqual());
938 node->ReplaceInput(0, StringComparison(node, true)); 937 node->ReplaceInput(0, StringComparison(node, true));
939 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 938 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
940 } 939 }
941 940
942 941
943 } // namespace compiler 942 } // namespace compiler
944 } // namespace internal 943 } // namespace internal
945 } // namespace v8 944 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.h ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698