@@ -129,6 +129,11 @@ DefinitionLocation NamespaceConstantInstruction::GetValueDefinition(
129129 return DefinitionLocation::Instruction (this , index);
130130}
131131
132+ std::ostream& operator <<(std::ostream& os,
133+ const NamespaceConstantInstruction& instruction) {
134+ return os << " NamespaceConstant " << instruction.constant ->external_name ();
135+ }
136+
132137void InstructionBase::InvalidateTransientTypes (
133138 Stack<const Type*>* stack) const {
134139 auto current = stack->begin ();
@@ -183,6 +188,22 @@ DefinitionLocation CallIntrinsicInstruction::GetValueDefinition(
183188 return DefinitionLocation::Instruction (this , index);
184189}
185190
191+ std::ostream& operator <<(std::ostream& os,
192+ const CallIntrinsicInstruction& instruction) {
193+ os << " CallIntrinsic " << instruction.intrinsic ->ReadableName ();
194+ if (!instruction.specialization_types .empty ()) {
195+ os << " <" ;
196+ PrintCommaSeparatedList (
197+ os, instruction.specialization_types ,
198+ [](const Type* type) -> const Type& { return *type; });
199+ os << " >" ;
200+ }
201+ os << " (" ;
202+ PrintCommaSeparatedList (os, instruction.constexpr_arguments );
203+ os << " )" ;
204+ return os;
205+ }
206+
186207void CallCsaMacroInstruction::TypeInstruction (Stack<const Type*>* stack,
187208 ControlFlowGraph* cfg) const {
188209 std::vector<const Type*> parameter_types =
@@ -243,6 +264,18 @@ DefinitionLocation CallCsaMacroInstruction::GetValueDefinition(
243264 return DefinitionLocation::Instruction (this , index);
244265}
245266
267+ std::ostream& operator <<(std::ostream& os,
268+ const CallCsaMacroInstruction& instruction) {
269+ os << " CallCsaMacro " << instruction.macro ->ReadableName ();
270+ os << " (" ;
271+ PrintCommaSeparatedList (os, instruction.constexpr_arguments );
272+ os << " )" ;
273+ if (instruction.catch_block ) {
274+ os << " , catch block " << (*instruction.catch_block )->id ();
275+ }
276+ return os;
277+ }
278+
246279void CallCsaMacroAndBranchInstruction::TypeInstruction (
247280 Stack<const Type*>* stack, ControlFlowGraph* cfg) const {
248281 std::vector<const Type*> parameter_types =
@@ -363,6 +396,26 @@ CallCsaMacroAndBranchInstruction::GetExceptionObjectDefinition() const {
363396 return DefinitionLocation::Instruction (this , GetValueDefinitionCount ());
364397}
365398
399+ std::ostream& operator <<(std::ostream& os,
400+ const CallCsaMacroAndBranchInstruction& instruction) {
401+ os << " CallCsaMacroAndBranch " << instruction.macro ->ReadableName ();
402+ os << " (" ;
403+ PrintCommaSeparatedList (os, instruction.constexpr_arguments );
404+ os << " )" ;
405+ if (instruction.return_continuation ) {
406+ os << " , return continuation " << (*instruction.return_continuation )->id ();
407+ }
408+ if (!instruction.label_blocks .empty ()) {
409+ os << " , label blocks " ;
410+ PrintCommaSeparatedList (os, instruction.label_blocks ,
411+ [](Block* block) { return block->id (); });
412+ }
413+ if (instruction.catch_block ) {
414+ os << " , catch block " << (*instruction.catch_block )->id ();
415+ }
416+ return os;
417+ }
418+
366419void CallBuiltinInstruction::TypeInstruction (Stack<const Type*>* stack,
367420 ControlFlowGraph* cfg) const {
368421 std::vector<const Type*> argument_types = stack->PopMany (argc);
@@ -447,6 +500,19 @@ DefinitionLocation CallBuiltinPointerInstruction::GetValueDefinition(
447500 return DefinitionLocation::Instruction (this , index);
448501}
449502
503+ std::ostream& operator <<(std::ostream& os,
504+ const CallBuiltinInstruction& instruction) {
505+ os << " CallBuiltin " << instruction.builtin ->ReadableName ()
506+ << " , argc: " << instruction.argc ;
507+ if (instruction.is_tailcall ) {
508+ os << " , is_tailcall" ;
509+ }
510+ if (instruction.catch_block ) {
511+ os << " , catch block " << (*instruction.catch_block )->id ();
512+ }
513+ return os;
514+ }
515+
450516void CallRuntimeInstruction::TypeInstruction (Stack<const Type*>* stack,
451517 ControlFlowGraph* cfg) const {
452518 std::vector<const Type*> argument_types = stack->PopMany (argc);
@@ -507,6 +573,19 @@ CallRuntimeInstruction::GetExceptionObjectDefinition() const {
507573 return DefinitionLocation::Instruction (this , GetValueDefinitionCount ());
508574}
509575
576+ std::ostream& operator <<(std::ostream& os,
577+ const CallRuntimeInstruction& instruction) {
578+ os << " CallRuntime " << instruction.runtime_function ->ReadableName ()
579+ << " , argc: " << instruction.argc ;
580+ if (instruction.is_tailcall ) {
581+ os << " , is_tailcall" ;
582+ }
583+ if (instruction.catch_block ) {
584+ os << " , catch block " << (*instruction.catch_block )->id ();
585+ }
586+ return os;
587+ }
588+
510589void BranchInstruction::TypeInstruction (Stack<const Type*>* stack,
511590 ControlFlowGraph* cfg) const {
512591 const Type* condition_type = stack->Pop ();
@@ -524,6 +603,12 @@ void BranchInstruction::RecomputeDefinitionLocations(
524603 if_false->MergeInputDefinitions (*locations, worklist);
525604}
526605
606+ std::ostream& operator <<(std::ostream& os,
607+ const BranchInstruction& instruction) {
608+ return os << " Branch true: " << instruction.if_true ->id ()
609+ << " , false: " << instruction.if_false ->id ();
610+ }
611+
527612void ConstexprBranchInstruction::TypeInstruction (Stack<const Type*>* stack,
528613 ControlFlowGraph* cfg) const {
529614 if_true->SetInputTypes (*stack);
@@ -536,6 +621,13 @@ void ConstexprBranchInstruction::RecomputeDefinitionLocations(
536621 if_false->MergeInputDefinitions (*locations, worklist);
537622}
538623
624+ std::ostream& operator <<(std::ostream& os,
625+ const ConstexprBranchInstruction& instruction) {
626+ return os << " ConstexprBranch " << instruction.condition
627+ << " , true: " << instruction.if_true ->id ()
628+ << " , false: " << instruction.if_false ->id ();
629+ }
630+
539631void GotoInstruction::TypeInstruction (Stack<const Type*>* stack,
540632 ControlFlowGraph* cfg) const {
541633 destination->SetInputTypes (*stack);
@@ -546,6 +638,10 @@ void GotoInstruction::RecomputeDefinitionLocations(
546638 destination->MergeInputDefinitions (*locations, worklist);
547639}
548640
641+ std::ostream& operator <<(std::ostream& os, const GotoInstruction& instruction) {
642+ return os << " Goto " << instruction.destination ->id ();
643+ }
644+
549645void GotoExternalInstruction::TypeInstruction (Stack<const Type*>* stack,
550646 ControlFlowGraph* cfg) const {
551647 if (variable_names.size () != stack->Size ()) {
@@ -693,6 +789,16 @@ DefinitionLocation MakeLazyNodeInstruction::GetValueDefinition() const {
693789 return DefinitionLocation::Instruction (this , 0 );
694790}
695791
792+ std::ostream& operator <<(std::ostream& os,
793+ const MakeLazyNodeInstruction& instruction) {
794+ os << " MakeLazyNode " << instruction.macro ->ReadableName () << " , "
795+ << *instruction.result_type ;
796+ for (const std::string& arg : instruction.constexpr_arguments ) {
797+ os << " , " << arg;
798+ }
799+ return os;
800+ }
801+
696802bool CallRuntimeInstruction::IsBlockTerminator () const {
697803 return is_tailcall || runtime_function->signature ().return_type ==
698804 TypeOracle::GetNeverType ();
0 commit comments