@@ -318,7 +318,7 @@ RuntimeOptimizer::add_global (ustring name, const TypeSpec &type)
318318
319319void
320320RuntimeOptimizer::turn_into_new_op (Opcode &op, ustring newop, int newarg1,
321- int newarg2, const char * why)
321+ int newarg2, string_view why)
322322{
323323 int opnum = &op - &(inst ()->ops ()[0 ]);
324324 DASSERT (opnum >= 0 && opnum < (int )inst ()->ops ().size ());
@@ -327,7 +327,7 @@ RuntimeOptimizer::turn_into_new_op (Opcode &op, ustring newop, int newarg1,
327327 << " from " << op.opname () << " to "
328328 << newop << ' ' << inst ()->symbol (newarg1)->name () << ' '
329329 << (newarg2<0 ? " " : inst ()->symbol (newarg2)->name ().c_str ())
330- << (why ? " : " : " " ) << ( why ? why : " " ) << " \n " ;
330+ << (why. size () ? " : " : " " ) << why << " \n " ;
331331 op.reset (newop, newarg2<0 ? 2 : 3 );
332332 op.argwriteonly (0 );
333333 inst ()->args ()[op.firstarg ()+1 ] = newarg1;
@@ -345,7 +345,7 @@ RuntimeOptimizer::turn_into_new_op (Opcode &op, ustring newop, int newarg1,
345345
346346
347347void
348- RuntimeOptimizer::turn_into_assign (Opcode &op, int newarg, const char * why)
348+ RuntimeOptimizer::turn_into_assign (Opcode &op, int newarg, string_view why)
349349{
350350 // We don't know the op num here, so we subtract the pointers
351351 int opnum = &op - &(inst ()->ops ()[0 ]);
@@ -354,7 +354,7 @@ RuntimeOptimizer::turn_into_assign (Opcode &op, int newarg, const char *why)
354354 << " from " << op.opname () << " to "
355355 << opargsym (op,0 )->name () << " = "
356356 << inst ()->symbol (newarg)->name ()
357- << (why ? " : " : " " ) << ( why ? why : " " ) << " \n " ;
357+ << (why. size () ? " : " : " " ) << why << " \n " ;
358358 op.reset (u_assign, 2 );
359359 inst ()->args ()[op.firstarg ()+1 ] = newarg;
360360 op.argwriteonly (0 );
@@ -371,7 +371,7 @@ RuntimeOptimizer::turn_into_assign (Opcode &op, int newarg, const char *why)
371371
372372// Turn the current op into a simple assignment to zero (of the first arg).
373373void
374- RuntimeOptimizer::turn_into_assign_zero (Opcode &op, const char * why)
374+ RuntimeOptimizer::turn_into_assign_zero (Opcode &op, string_view why)
375375{
376376 static float zero[16 ] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
377377 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
@@ -384,7 +384,7 @@ RuntimeOptimizer::turn_into_assign_zero (Opcode &op, const char *why)
384384
385385// Turn the current op into a simple assignment to one (of the first arg).
386386void
387- RuntimeOptimizer::turn_into_assign_one (Opcode &op, const char * why)
387+ RuntimeOptimizer::turn_into_assign_one (Opcode &op, string_view why)
388388{
389389 Symbol &R (*(inst ()->argsymbol (op.firstarg ()+0 )));
390390 if (R.typespec ().is_int ()) {
@@ -403,13 +403,13 @@ RuntimeOptimizer::turn_into_assign_one (Opcode &op, const char *why)
403403
404404// Turn the op into a no-op
405405int
406- RuntimeOptimizer::turn_into_nop (Opcode &op, const char * why)
406+ RuntimeOptimizer::turn_into_nop (Opcode &op, string_view why)
407407{
408408 if (op.opname () != u_nop) {
409409 if (debug () > 1 )
410410 std::cout << " turned op " << (&op - &(inst ()->ops ()[0 ]))
411411 << " from " << op.opname () << " to nop"
412- << (why ? " : " : " " ) << ( why ? why : " " ) << " \n " ;
412+ << (why. size () ? " : " : " " ) << why << " \n " ;
413413 op.reset (u_nop, 0 );
414414 return 1 ;
415415 }
@@ -419,7 +419,7 @@ RuntimeOptimizer::turn_into_nop (Opcode &op, const char *why)
419419
420420
421421int
422- RuntimeOptimizer::turn_into_nop (int begin, int end, const char * why)
422+ RuntimeOptimizer::turn_into_nop (int begin, int end, string_view why)
423423{
424424 int changed = 0 ;
425425 for (int i = begin; i != end; ++i) {
@@ -431,7 +431,7 @@ RuntimeOptimizer::turn_into_nop (int begin, int end, const char *why)
431431 }
432432 if (debug () > 1 && changed)
433433 std::cout << " turned ops " << begin << " -" << (end-1 ) << " into nop"
434- << (why ? " : " : " " ) << ( why ? why : " " ) << " \n " ;
434+ << (why. size () ? " : " : " " ) << why << " \n " ;
435435 return changed;
436436}
437437
@@ -1213,12 +1213,12 @@ struct ConnectionDestIs
12131213// / no longer need; turn it into a a plain old instance-value
12141214// / parameter.
12151215void
1216- RuntimeOptimizer::make_param_use_instanceval (Symbol *R, const char * why)
1216+ RuntimeOptimizer::make_param_use_instanceval (Symbol *R, string_view why)
12171217{
12181218 if (debug () > 1 )
12191219 std::cout << " Turning " << R->valuesourcename () << ' '
12201220 << R->name () << " into an instance value "
1221- << ( why ? why : " " ) << " \n " ;
1221+ << why << " \n " ;
12221222
12231223 // Mark its source as the instance value, not connected
12241224 R->valuesource (Symbol::InstanceVal);
0 commit comments