22class MachineRepresentationInferrer {
24 MachineRepresentationInferrer(Schedule
const*
schedule, TFGraph
const* graph,
33 CallDescriptor* call_descriptor()
const {
34 return linkage_->GetIncomingDescriptor();
60 for (BasicBlock* block : *blocks) {
62 for (
size_t i = 0;
i <= block->NodeCount(); ++
i) {
64 i < block->NodeCount() ? block->NodeAt(
i) : block->control_input();
65 if (node ==
nullptr) {
69 switch (node->opcode()) {
70 case IrOpcode::kParameter:
75 case IrOpcode::kReturn: {
77 linkage_->GetReturnType().representation());
80 case IrOpcode::kProjection: {
84 case IrOpcode::kTypedStateValues:
87 case IrOpcode::kWord32AtomicLoad:
88 case IrOpcode::kWord64AtomicLoad:
95 case IrOpcode::kLoadImmutable:
96 case IrOpcode::kProtectedLoad:
97 case IrOpcode::kLoadTrapOnNull:
101 case IrOpcode::kLoadFramePointer:
102 case IrOpcode::kLoadParentFramePointer:
103 case IrOpcode::kStackSlot:
104 case IrOpcode::kLoadRootRegister:
105#if V8_ENABLE_WEBASSEMBLY
106 case IrOpcode::kLoadStackPointer:
111 case IrOpcode::kUnalignedLoad:
119 case IrOpcode::kCall: {
121 if (call_descriptor->ReturnCount() > 0) {
123 call_descriptor->GetReturnType(0).representation();
130 case IrOpcode::kWord32AtomicStore:
131 case IrOpcode::kWord64AtomicStore:
135 case IrOpcode::kWord32AtomicPairLoad:
136 case IrOpcode::kWord32AtomicPairStore:
137 case IrOpcode::kWord32AtomicPairAdd:
138 case IrOpcode::kWord32AtomicPairSub:
139 case IrOpcode::kWord32AtomicPairAnd:
140 case IrOpcode::kWord32AtomicPairOr:
141 case IrOpcode::kWord32AtomicPairXor:
142 case IrOpcode::kWord32AtomicPairExchange:
143 case IrOpcode::kWord32AtomicPairCompareExchange:
146 case IrOpcode::kWord32AtomicExchange:
147 case IrOpcode::kWord32AtomicCompareExchange:
148 case IrOpcode::kWord32AtomicAdd:
149 case IrOpcode::kWord32AtomicSub:
150 case IrOpcode::kWord32AtomicAnd:
151 case IrOpcode::kWord32AtomicOr:
152 case IrOpcode::kWord32AtomicXor:
153 case IrOpcode::kWord64AtomicExchange:
154 case IrOpcode::kWord64AtomicCompareExchange:
155 case IrOpcode::kWord64AtomicAdd:
156 case IrOpcode::kWord64AtomicSub:
157 case IrOpcode::kWord64AtomicAnd:
158 case IrOpcode::kWord64AtomicOr:
159 case IrOpcode::kWord64AtomicXor:
163 case IrOpcode::kStore:
164 case IrOpcode::kProtectedStore:
165 case IrOpcode::kStoreTrapOnNull:
166 case IrOpcode::kStoreIndirectPointer:
170 case IrOpcode::kUnalignedStore:
174 case IrOpcode::kHeapConstant:
178 case IrOpcode::kNumberConstant:
179 case IrOpcode::kChangeBitToTagged:
180 case IrOpcode::kIfException:
181 case IrOpcode::kOsrValue:
182 case IrOpcode::kChangeInt32ToTagged:
183 case IrOpcode::kChangeUint32ToTagged:
184 case IrOpcode::kBitcastWordToTagged:
185 case IrOpcode::kTaggedIndexConstant:
188 case IrOpcode::kCompressedHeapConstant:
192 case IrOpcode::kExternalConstant:
196 case IrOpcode::kBitcastTaggedToWord:
197 case IrOpcode::kBitcastTaggedToWordForTagAndSmiBits:
201 case IrOpcode::kBitcastWordToTaggedSigned:
205 case IrOpcode::kWord32Equal:
206 case IrOpcode::kInt32LessThan:
207 case IrOpcode::kInt32LessThanOrEqual:
208 case IrOpcode::kUint32LessThan:
209 case IrOpcode::kUint32LessThanOrEqual:
210 case IrOpcode::kWord64Equal:
211 case IrOpcode::kInt64LessThan:
212 case IrOpcode::kInt64LessThanOrEqual:
213 case IrOpcode::kUint64LessThan:
214 case IrOpcode::kUint64LessThanOrEqual:
215 case IrOpcode::kFloat32Equal:
216 case IrOpcode::kFloat32LessThan:
217 case IrOpcode::kFloat32LessThanOrEqual:
218 case IrOpcode::kFloat64Equal:
219 case IrOpcode::kFloat64LessThan:
220 case IrOpcode::kFloat64LessThanOrEqual:
221 case IrOpcode::kChangeTaggedToBit:
222 case IrOpcode::kStackPointerGreaterThan:
225#define LABEL(opcode) case IrOpcode::k##opcode:
226 case IrOpcode::kTruncateInt64ToInt32:
227 case IrOpcode::kTruncateFloat32ToInt32:
228 case IrOpcode::kTruncateFloat32ToUint32:
229 case IrOpcode::kBitcastFloat32ToInt32:
230#if V8_ENABLE_WEBASSEMBLY
231 case IrOpcode::kI32x4ExtractLane:
232 case IrOpcode::kI16x8ExtractLaneU:
233 case IrOpcode::kI16x8ExtractLaneS:
234 case IrOpcode::kI8x16ExtractLaneU:
235 case IrOpcode::kI8x16ExtractLaneS:
236 case IrOpcode::kI8x16BitMask:
238 case IrOpcode::kInt32Constant:
239 case IrOpcode::kRelocatableInt32Constant:
240 case IrOpcode::kTruncateFloat64ToWord32:
241 case IrOpcode::kTruncateFloat64ToUint32:
242 case IrOpcode::kChangeFloat64ToInt32:
243 case IrOpcode::kChangeFloat64ToUint32:
244 case IrOpcode::kRoundFloat64ToInt32:
245 case IrOpcode::kFloat64ExtractLowWord32:
246 case IrOpcode::kFloat64ExtractHighWord32:
247 case IrOpcode::kWord32Popcnt:
254 case IrOpcode::kChangeInt32ToInt64:
255 case IrOpcode::kChangeUint32ToUint64:
256 case IrOpcode::kBitcastWord32ToWord64:
257 case IrOpcode::kInt64Constant:
258 case IrOpcode::kRelocatableInt64Constant:
259 case IrOpcode::kBitcastFloat64ToInt64:
260 case IrOpcode::kChangeFloat64ToInt64:
261 case IrOpcode::kChangeFloat64ToUint64:
262 case IrOpcode::kTruncateFloat64ToInt64:
263 case IrOpcode::kWord64Popcnt:
264 case IrOpcode::kWord64Ctz:
265 case IrOpcode::kWord64Clz:
271 case IrOpcode::kRoundInt32ToFloat32:
272 case IrOpcode::kRoundUint32ToFloat32:
273 case IrOpcode::kRoundInt64ToFloat32:
274 case IrOpcode::kRoundUint64ToFloat32:
275 case IrOpcode::kBitcastInt32ToFloat32:
276 case IrOpcode::kFloat32Constant:
277 case IrOpcode::kTruncateFloat64ToFloat32:
284 case IrOpcode::kRoundInt64ToFloat64:
285 case IrOpcode::kRoundUint64ToFloat64:
286 case IrOpcode::kBitcastInt64ToFloat64:
287 case IrOpcode::kChangeFloat32ToFloat64:
288 case IrOpcode::kChangeInt32ToFloat64:
289 case IrOpcode::kChangeUint32ToFloat64:
290 case IrOpcode::kFloat64InsertLowWord32:
291 case IrOpcode::kFloat64InsertHighWord32:
292 case IrOpcode::kFloat64Constant:
293 case IrOpcode::kFloat64SilenceNaN:
300#if V8_ENABLE_WEBASSEMBLY
301 case IrOpcode::kI32x4ReplaceLane:
302 case IrOpcode::kI32x4Splat:
303 case IrOpcode::kI8x16Splat:
304 case IrOpcode::kI8x16Eq:
323class MachineRepresentationChecker {
325 MachineRepresentationChecker(
327 MachineRepresentationInferrer
const*
const inferrer,
bool is_stub,
337 for (BasicBlock* block : *blocks) {
339 for (
size_t i = 0;
i <= block->NodeCount(); ++
i) {
341 i < block->NodeCount() ? block->NodeAt(
i) : block->control_input();
342 if (node ==
nullptr) {
346 switch (node->opcode()) {
347 case IrOpcode::kCall:
348 case IrOpcode::kTailCall:
349 CheckCallInputs(node);
351 case IrOpcode::kChangeBitToTagged:
353 inferrer_->GetRepresentation(node->InputAt(0)));
355 case IrOpcode::kChangeTaggedToBit:
357 inferrer_->GetRepresentation(node->InputAt(0)));
359 case IrOpcode::kRoundInt64ToFloat64:
360 case IrOpcode::kRoundUint64ToFloat64:
361 case IrOpcode::kRoundInt64ToFloat32:
362 case IrOpcode::kRoundUint64ToFloat32:
363 case IrOpcode::kTruncateInt64ToInt32:
364 case IrOpcode::kBitcastInt64ToFloat64:
365 case IrOpcode::kWord64Ctz:
366 case IrOpcode::kWord64Clz:
367 case IrOpcode::kWord64Popcnt:
368 CheckValueInputForInt64Op(node, 0);
370 case IrOpcode::kBitcastWordToTagged:
371 case IrOpcode::kBitcastWordToTaggedSigned:
372 CheckValueInputRepresentationIs(
375 case IrOpcode::kBitcastTaggedToWord:
376 case IrOpcode::kBitcastTaggedToWordForTagAndSmiBits:
378 CheckValueInputIsCompressedOrTagged(node, 0);
380 CheckValueInputIsTagged(node, 0);
383 case IrOpcode::kTruncateFloat64ToWord32:
384 case IrOpcode::kTruncateFloat64ToUint32:
385 case IrOpcode::kTruncateFloat64ToFloat32:
386 case IrOpcode::kChangeFloat64ToInt32:
387 case IrOpcode::kChangeFloat64ToUint32:
388 case IrOpcode::kRoundFloat64ToInt32:
389 case IrOpcode::kFloat64ExtractLowWord32:
390 case IrOpcode::kFloat64ExtractHighWord32:
391 case IrOpcode::kBitcastFloat64ToInt64:
392 case IrOpcode::kTryTruncateFloat64ToInt64:
393 case IrOpcode::kTryTruncateFloat64ToInt32:
394 case IrOpcode::kTryTruncateFloat64ToUint32:
395 CheckValueInputForFloat64Op(node, 0);
397 case IrOpcode::kWord64Equal:
399 CheckValueInputIsTaggedOrPointer(node, 0);
400 CheckValueInputIsTaggedOrPointer(node, 1);
402 CheckValueInputRepresentationIs(
403 node, 1,
inferrer_->GetRepresentation(node->InputAt(0)));
406 CheckValueInputForInt64Op(node, 0);
407 CheckValueInputForInt64Op(node, 1);
410 case IrOpcode::kInt64LessThan:
411 case IrOpcode::kInt64LessThanOrEqual:
412 case IrOpcode::kUint64LessThan:
413 case IrOpcode::kUint64LessThanOrEqual:
414 CheckValueInputForInt64Op(node, 0);
415 CheckValueInputForInt64Op(node, 1);
417#if V8_ENABLE_WEBASSEMBLY
418 case IrOpcode::kI32x4ExtractLane:
419 case IrOpcode::kI16x8ExtractLaneU:
420 case IrOpcode::kI16x8ExtractLaneS:
421 case IrOpcode::kI8x16BitMask:
422 case IrOpcode::kI8x16ExtractLaneU:
423 case IrOpcode::kI8x16ExtractLaneS:
424 CheckValueInputRepresentationIs(node, 0,
427 case IrOpcode::kI32x4ReplaceLane:
428 CheckValueInputRepresentationIs(node, 0,
430 CheckValueInputForInt32Op(node, 1);
432 case IrOpcode::kI32x4Splat:
433 case IrOpcode::kI8x16Splat:
434 CheckValueInputForInt32Op(node, 0);
436 case IrOpcode::kI8x16Eq:
437 CheckValueInputRepresentationIs(node, 0,
439 CheckValueInputRepresentationIs(node, 1,
444#define LABEL(opcode) case IrOpcode::k##opcode:
445 case IrOpcode::kChangeInt32ToTagged:
446 case IrOpcode::kChangeUint32ToTagged:
447 case IrOpcode::kChangeInt32ToFloat64:
448 case IrOpcode::kChangeUint32ToFloat64:
449 case IrOpcode::kRoundInt32ToFloat32:
450 case IrOpcode::kRoundUint32ToFloat32:
451 case IrOpcode::kBitcastInt32ToFloat32:
452 case IrOpcode::kBitcastWord32ToWord64:
453 case IrOpcode::kChangeInt32ToInt64:
454 case IrOpcode::kChangeUint32ToUint64:
455 case IrOpcode::kWord32Popcnt:
459 case IrOpcode::kWord32Equal:
460 case IrOpcode::kUint32LessThan:
461 case IrOpcode::kUint32LessThanOrEqual:
463 CheckValueInputIsTaggedOrPointer(node, 0);
464 CheckValueInputIsTaggedOrPointer(node, 1);
466 CheckValueInputRepresentationIs(
467 node, 1,
inferrer_->GetRepresentation(node->InputAt(0)));
471 CheckValueInputIsCompressedOrTaggedOrInt32(node, 0);
472 CheckValueInputIsCompressedOrTaggedOrInt32(node, 1);
474 CheckValueIsTaggedOrInt32(node, 0);
475 CheckValueIsTaggedOrInt32(node, 1);
480 case IrOpcode::kInt32LessThan:
481 case IrOpcode::kInt32LessThanOrEqual:
483 CheckValueInputForInt32Op(node, 0);
484 CheckValueInputForInt32Op(node, 1);
488 CheckValueInputForInt64Op(node, 0);
489 CheckValueInputForInt64Op(node, 1);
492 case IrOpcode::kFloat32Equal:
493 case IrOpcode::kFloat32LessThan:
494 case IrOpcode::kFloat32LessThanOrEqual:
496 CheckValueInputForFloat32Op(node, 0);
497 CheckValueInputForFloat32Op(node, 1);
500 case IrOpcode::kChangeFloat32ToFloat64:
501 case IrOpcode::kTruncateFloat32ToInt32:
502 case IrOpcode::kTruncateFloat32ToUint32:
503 case IrOpcode::kBitcastFloat32ToInt32:
505 CheckValueInputForFloat32Op(node, 0);
508 case IrOpcode::kFloat64Equal:
509 case IrOpcode::kFloat64LessThan:
510 case IrOpcode::kFloat64LessThanOrEqual:
512 CheckValueInputForFloat64Op(node, 0);
513 CheckValueInputForFloat64Op(node, 1);
516 case IrOpcode::kFloat64SilenceNaN:
517 case IrOpcode::kChangeFloat64ToInt64:
518 case IrOpcode::kChangeFloat64ToUint64:
519 case IrOpcode::kTruncateFloat64ToInt64:
521 CheckValueInputForFloat64Op(node, 0);
525 case IrOpcode::kFloat64InsertLowWord32:
526 case IrOpcode::kFloat64InsertHighWord32:
527 CheckValueInputForFloat64Op(node, 0);
528 CheckValueInputForInt32Op(node, 1);
530 case IrOpcode::kInt32PairAdd:
531 case IrOpcode::kInt32PairSub:
532 for (
int j = 0; j < node->op()->ValueInputCount(); ++j) {
533 CheckValueInputForInt32Op(node, j);
536 case IrOpcode::kParameter:
537 case IrOpcode::kProjection:
539 case IrOpcode::kAbortCSADcheck:
540 CheckValueInputIsTagged(node, 0);
542 case IrOpcode::kLoad:
543 case IrOpcode::kUnalignedLoad:
544 case IrOpcode::kLoadImmutable:
545 case IrOpcode::kWord32AtomicLoad:
546 case IrOpcode::kWord32AtomicPairLoad:
547 case IrOpcode::kWord64AtomicLoad:
548 CheckValueInputIsTaggedOrPointer(node, 0);
549 CheckValueInputRepresentationIs(
552 case IrOpcode::kWord32AtomicPairAdd:
553 case IrOpcode::kWord32AtomicPairSub:
554 case IrOpcode::kWord32AtomicPairAnd:
555 case IrOpcode::kWord32AtomicPairOr:
556 case IrOpcode::kWord32AtomicPairXor:
557 case IrOpcode::kWord32AtomicPairStore:
558 case IrOpcode::kWord32AtomicPairExchange:
559 CheckValueInputRepresentationIs(node, 3,
562 case IrOpcode::kStore:
563 case IrOpcode::kStoreIndirectPointer:
564 case IrOpcode::kUnalignedStore:
565 case IrOpcode::kWord32AtomicStore:
566 case IrOpcode::kWord32AtomicExchange:
567 case IrOpcode::kWord32AtomicAdd:
568 case IrOpcode::kWord32AtomicSub:
569 case IrOpcode::kWord32AtomicAnd:
570 case IrOpcode::kWord32AtomicOr:
571 case IrOpcode::kWord32AtomicXor:
572 case IrOpcode::kWord64AtomicStore:
573 case IrOpcode::kWord64AtomicExchange:
574 case IrOpcode::kWord64AtomicAdd:
575 case IrOpcode::kWord64AtomicSub:
576 case IrOpcode::kWord64AtomicAnd:
577 case IrOpcode::kWord64AtomicOr:
578 case IrOpcode::kWord64AtomicXor:
579 CheckValueInputIsTaggedOrPointer(node, 0);
580 CheckValueInputRepresentationIs(
582 switch (
inferrer_->GetRepresentation(node)) {
588 ((node->opcode() == IrOpcode::kStore &&
591 (node->opcode() == IrOpcode::kWord32AtomicStore &&
594 CheckValueInputIsCompressedOrTagged(node, 2);
596 CheckValueInputIsTagged(node, 2);
600 CheckValueInputRepresentationIs(
601 node, 2,
inferrer_->GetRepresentation(node));
604 case IrOpcode::kStorePair: {
605 CheckValueInputIsTaggedOrPointer(node, 0);
606 CheckValueInputRepresentationIs(
615 CheckValueInputIsCompressedOrTagged(node, input);
617 CheckValueInputIsTagged(node, input);
621 CheckValueInputRepresentationIs(node, input, rep);
628 CheckInput(rep.first.representation(), 2);
629 CheckInput(rep.second.representation(), 3);
632 case IrOpcode::kWord32AtomicPairCompareExchange:
633 CheckValueInputRepresentationIs(node, 4,
635 CheckValueInputRepresentationIs(node, 5,
638 case IrOpcode::kWord32AtomicCompareExchange:
639 case IrOpcode::kWord64AtomicCompareExchange:
640 CheckValueInputIsTaggedOrPointer(node, 0);
641 CheckValueInputRepresentationIs(
643 switch (
inferrer_->GetRepresentation(node)) {
647 CheckValueInputIsTagged(node, 2);
648 CheckValueInputIsTagged(node, 3);
651 CheckValueInputRepresentationIs(
652 node, 2,
inferrer_->GetRepresentation(node));
653 CheckValueInputRepresentationIs(
654 node, 3,
inferrer_->GetRepresentation(node));
658 switch (
inferrer_->GetRepresentation(node)) {
661 for (
int j = 0; j < node->op()->ValueInputCount(); ++j) {
662 CheckValueInputIsTagged(node, j);
666 for (
int j = 0; j < node->op()->ValueInputCount(); ++j) {
668 CheckValueInputIsCompressedOrTagged(node, j);
670 CheckValueInputIsTagged(node, j);
676 for (
int j = 0; j < node->op()->ValueInputCount(); ++j) {
677 CheckValueInputIsCompressedOrTagged(node, j);
681 for (
int j = 0; j < node->op()->ValueInputCount(); ++j) {
682 CheckValueInputForInt32Op(node, j);
686 for (
int j = 0; j < node->op()->ValueInputCount(); ++j) {
687 CheckValueInputRepresentationIs(
688 node, j,
inferrer_->GetRepresentation(node));
693 case IrOpcode::kBranch:
694 case IrOpcode::kSwitch:
695 CheckValueInputForInt32Op(node, 0);
697 case IrOpcode::kReturn: {
703 size_t return_count =
inferrer_->call_descriptor()->ReturnCount();
704 for (
size_t j = 0; j < return_count; j++) {
705 MachineType type =
inferrer_->call_descriptor()->GetReturnType(j);
706 int input_index =
static_cast<int>(j + 1);
707 switch (type.representation()) {
711 CheckValueInputIsTagged(node, input_index);
714 CheckValueInputForInt32Op(node, input_index);
717 CheckValueInputRepresentationIs(node, input_index,
718 type.representation());
724#if V8_ENABLE_WEBASSEMBLY
725 case IrOpcode::kSetStackPointer:
727 case IrOpcode::kStackPointerGreaterThan:
728 CheckValueInputRepresentationIs(
731 case IrOpcode::kThrow:
732 case IrOpcode::kTypedStateValues:
733 case IrOpcode::kFrameState:
734 case IrOpcode::kStaticAssert:
737 if (node->op()->ValueInputCount() != 0) {
738 std::stringstream str;
739 str <<
"Node #" << node->id() <<
":" << *node->op()
740 <<
" in the machine graph is not being checked.";
741 PrintDebugHelp(str, node);
742 FATAL(
"%s", str.str().c_str());
760 void CheckValueInputRepresentationIs(Node
const* node,
int index,
762 Node
const* input = node->InputAt(index);
765 if (input_representation != representation) {
766 std::stringstream str;
767 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
768 <<
" uses node #" << input->id() <<
":" << *input->op() <<
":"
769 << input_representation <<
" which doesn't have a " << representation
770 <<
" representation.";
771 PrintDebugHelp(str, node);
772 FATAL(
"%s", str.str().c_str());
776 void CheckValueInputIsTagged(Node
const* node,
int index) {
777 Node
const* input = node->InputAt(index);
778 switch (
inferrer_->GetRepresentation(input)) {
786 std::ostringstream str;
787 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
788 <<
" uses node #" << input->id() <<
":" << *input->op()
789 <<
" which doesn't have a tagged representation.";
790 PrintDebugHelp(str, node);
791 FATAL(
"%s", str.str().c_str());
794 void CheckValueInputIsCompressedOrTagged(Node
const* node,
int index) {
795 Node
const* input = node->InputAt(index);
796 switch (
inferrer_->GetRepresentation(input)) {
806 std::ostringstream str;
807 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
808 <<
" uses node #" << input->id() <<
":" << *input->op()
809 <<
" which doesn't have a compressed or tagged representation.";
810 PrintDebugHelp(str, node);
811 FATAL(
"%s", str.str().c_str());
814 void CheckValueInputIsCompressedOrTaggedOrInt32(Node
const* node,
int index) {
815 Node
const* input = node->InputAt(index);
816 switch (
inferrer_->GetRepresentation(input)) {
832 std::ostringstream str;
833 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
834 <<
" uses node #" << input->id() <<
":" << *input->op()
835 <<
" which doesn't have a compressed, tagged, or int32 representation.";
836 PrintDebugHelp(str, node);
837 FATAL(
"%s", str.str().c_str());
840 void CheckValueInputIsTaggedOrPointer(Node
const* node,
int index) {
841 Node
const* input = node->InputAt(index);
864 switch (node->opcode()) {
865 case IrOpcode::kLoad:
866 case IrOpcode::kProtectedLoad:
867 case IrOpcode::kLoadTrapOnNull:
868 case IrOpcode::kUnalignedLoad:
869 case IrOpcode::kLoadImmutable:
880 if (
inferrer_->GetRepresentation(input) !=
882 std::ostringstream str;
883 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
884 <<
" uses node #" << input->id() <<
":" << *input->op()
885 <<
" which doesn't have a tagged or pointer representation.";
886 PrintDebugHelp(str, node);
887 FATAL(
"%s", str.str().c_str());
891 void CheckValueInputForInt32Op(Node
const* node,
int index) {
892 Node
const* input = node->InputAt(index);
893 switch (
inferrer_->GetRepresentation(input)) {
900 std::ostringstream str;
901 str <<
"TypeError: node #" << input->id() <<
":" << *input->op()
903 PrintDebugHelp(str, node);
904 FATAL(
"%s", str.str().c_str());
909 std::ostringstream str;
910 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
911 <<
" uses node #" << input->id() <<
":" << *input->op()
912 <<
" which doesn't have an int32-compatible representation.";
913 PrintDebugHelp(str, node);
914 FATAL(
"%s", str.str().c_str());
917 void CheckValueIsTaggedOrInt32(Node
const* node,
int index) {
918 Node
const* input = node->InputAt(index);
919 switch (
inferrer_->GetRepresentation(input)) {
931 std::ostringstream str;
932 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
933 <<
" uses node #" << input->id() <<
":" << *input->op()
934 <<
" which doesn't have a tagged or int32-compatible "
936 PrintDebugHelp(str, node);
937 FATAL(
"%s", str.str().c_str());
940 void CheckValueInputForInt64Op(Node
const* node,
int index) {
941 Node
const* input = node->InputAt(index);
944 switch (input_representation) {
948 std::ostringstream str;
949 str <<
"TypeError: node #" << input->id() <<
":" << *input->op()
951 PrintDebugHelp(str, node);
952 FATAL(
"%s", str.str().c_str());
958 std::ostringstream str;
959 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
960 <<
" uses node #" << input->id() <<
":" << *input->op() <<
":"
961 << input_representation
962 <<
" which doesn't have a kWord64 representation.";
963 PrintDebugHelp(str, node);
964 FATAL(
"%s", str.str().c_str());
967 void CheckValueInputForFloat32Op(Node
const* node,
int index) {
968 Node
const* input = node->InputAt(index);
973 std::ostringstream str;
974 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
975 <<
" uses node #" << input->id() <<
":" << *input->op()
976 <<
" which doesn't have a kFloat32 representation.";
977 PrintDebugHelp(str, node);
978 FATAL(
"%s", str.str().c_str());
981 void CheckValueInputForFloat64Op(Node
const* node,
int index) {
982 Node
const* input = node->InputAt(index);
987 std::ostringstream str;
988 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
989 <<
" uses node #" << input->id() <<
":" << *input->op()
990 <<
" which doesn't have a kFloat64 representation.";
991 PrintDebugHelp(str, node);
992 FATAL(
"%s", str.str().c_str());
995 void CheckCallInputs(Node
const* node) {
997 std::ostringstream str;
998 bool should_log_error =
false;
999 for (
size_t i = 0;
i < call_descriptor->InputCount(); ++
i) {
1000 Node
const* input = node->InputAt(
static_cast<int>(
i));
1004 call_descriptor->GetInputType(
i).representation();
1005 if (!IsCompatible(expected_input_type, input_type)) {
1006 if (!should_log_error) {
1007 should_log_error =
true;
1008 str <<
"TypeError: node #" << node->id() <<
":" << *node->op()
1009 <<
" has wrong type for:" << std::endl;
1013 str <<
" * input " <<
i <<
" (" << input->
id() <<
":" << *input->op()
1014 <<
") has a " << input_type
1015 <<
" representation (expected: " << expected_input_type <<
").";
1018 if (should_log_error) {
1019 PrintDebugHelp(str, node);
1020 FATAL(
"%s", str.str().c_str());
1055 return expected == actual;
1067 void PrintDebugHelp(std::ostream& out, Node
const* node) {
1070 out <<
"\n#\n# Specify option --csa-trap-on-node=" <<
name_ <<
","
1071 << node->id() <<
" for debugging.";
1087 MachineRepresentationInferrer representation_inferrer(
schedule, graph,
1089 MachineRepresentationChecker checker(
schedule, &representation_inferrer,
constexpr MachineRepresentation representation() const
static constexpr MachineRepresentation PointerRepresentation()
LoadRepresentation representation() const
MachineRepresentation representation() const
static void Run(TFGraph *graph, Schedule const *const schedule, Linkage *linkage, bool is_stub, const char *name, Zone *temp_zone)
static MachineRepresentation GetProjectionType(Node const *projection)
MachineRepresentation representation() const
#define COMPRESS_POINTERS_BOOL
#define DECOMPRESS_POINTER_BY_ADDRESSING_MODE
ZoneVector< MachineRepresentation > representation_vector_
Schedule const *const schedule_
BasicBlock * current_block_
Linkage const *const linkage_
MachineRepresentationInferrer const *const inferrer_
AtomicStoreParameters const & AtomicStoreParametersOf(Operator const *op)
StoreRepresentation const & StoreRepresentationOf(Operator const *op)
CallDescriptor const * CallDescriptorOf(const Operator *const op)
AtomicLoadParameters AtomicLoadParametersOf(Operator const *op)
int ParameterIndexOf(const Operator *const op)
MachineType AtomicOpType(InstructionSelectorT *selector, OpIndex node)
StorePairRepresentation const & StorePairRepresentationOf(Operator const *op)
LoadRepresentation LoadRepresentationOf(Operator const *op)
ZoneVector< BasicBlock * > BasicBlockVector
UnalignedStoreRepresentation const & UnalignedStoreRepresentationOf(Operator const *op)
MachineRepresentation PhiRepresentationOf(const Operator *const op)
constexpr bool IsAnyTagged(MachineRepresentation rep)
constexpr bool IsAnyCompressed(MachineRepresentation rep)
V8_EXPORT_PRIVATE constexpr int ElementSizeLog2Of(MachineRepresentation)
#define MACHINE_FLOAT32_UNOP_LIST(V)
#define MACHINE_FLOAT32_BINOP_LIST(V)
#define MACHINE_BINOP_64_LIST(V)
#define MACHINE_FLOAT64_BINOP_LIST(V)
#define MACHINE_UNOP_32_LIST(V)
#define MACHINE_BINOP_32_LIST(V)
#define MACHINE_FLOAT64_UNOP_LIST(V)
#define CHECK_GE(lhs, rhs)
#define CHECK_EQ(lhs, rhs)
#define DCHECK_EQ(v1, v2)