@@ -186,7 +186,7 @@ int goto_instrument_parseoptionst::doit()
186
186
187
187
if (cmdline.isset (" interpreter" ))
188
188
{
189
- status (" Starting interpeter " );
189
+ status (" Starting interpreter " );
190
190
interpreter (context, goto_functions);
191
191
return 0 ;
192
192
}
@@ -225,13 +225,11 @@ int goto_instrument_parseoptionst::doit()
225
225
return 0 ;
226
226
}
227
227
228
- // experimental: print structs
229
228
if (cmdline.isset (" show-struct-alignment" ))
230
229
{
231
230
print_struct_alignment_problems (context, std::cout);
232
231
return 0 ;
233
232
}
234
- // end of experiment
235
233
236
234
if (cmdline.isset (" show-locations" ))
237
235
{
@@ -426,6 +424,32 @@ void goto_instrument_parseoptionst::instrument_goto_program(
426
424
if (cmdline.isset (" error-label" ))
427
425
options.set_option (" error-label" , cmdline.getval (" error-label" ));
428
426
427
+ // unwind loops
428
+ if (cmdline.isset (" unwind" ))
429
+ {
430
+ status (" Unwinding loops" );
431
+ options.set_option (" unwind" , cmdline.getval (" unwind" ));
432
+ }
433
+
434
+ // max number of variables in a cycle (default 0: no max)
435
+ if (cmdline.isset (" max-var" ))
436
+ options.set_option (" max-var" , cmdline.getval (" max-var" ));
437
+
438
+ // max number of transition by po (default 0: no limit)
439
+ if (cmdline.isset (" max-po-trans" ))
440
+ options.set_option (" max-po-trans" , cmdline.getval (" max-po-trans" ));
441
+
442
+ // strategy of instrumentation
443
+ if (cmdline.isset (" one-event-per-cycle" ))
444
+ options.set_option (" event-strategy" , 1 );
445
+ else if (cmdline.isset (" minimum-interference" ))
446
+ options.set_option (" event-strategy" , 2 );
447
+ else if (cmdline.isset (" my-events" ))
448
+ options.set_option (" event-strategy" , 3 );
449
+ else
450
+ options.set_option (" event-strategy" , 0 );
451
+
452
+
429
453
namespacet ns (context);
430
454
431
455
// add generic checks, if needed
@@ -465,7 +489,7 @@ void goto_instrument_parseoptionst::instrument_goto_program(
465
489
cmdline.isset (" race-check" ) ||
466
490
cmdline.isset (" tso" ) ||
467
491
cmdline.isset (" pso" ) ||
468
- cmdline.isset (" rso " ) ||
492
+ cmdline.isset (" rmo " ) ||
469
493
cmdline.isset (" power" ) ||
470
494
cmdline.isset (" isr" ) ||
471
495
cmdline.isset (" concurrency" ))
@@ -506,71 +530,95 @@ void goto_instrument_parseoptionst::instrument_goto_program(
506
530
goto_functions);
507
531
}
508
532
509
- // const unsigned unwind_loops=
510
- // cmdline.isset("unwind")?options.get_int_option("unwind"):0;
533
+ const unsigned unwind_loops =
534
+ ( cmdline.isset (" unwind" )?options.get_int_option (" unwind" ):0 );
535
+ const unsigned max_var =
536
+ ( cmdline.isset (" max-var" )?options.get_int_option (" max-var" ):0 );
537
+ const unsigned max_po_trans =
538
+ ( cmdline.isset (" max-po-trans" )?options.get_int_option (" max-po-trans" ):0 );
511
539
512
540
if (cmdline.isset (" tso" ))
513
541
{
514
- #if 0
515
542
status (" Adding weak memory (TSO) Instrumentation" );
516
543
weak_memory (
517
544
TSO,
518
545
value_set_analysis,
519
546
context,
520
547
goto_functions,
521
- cmdline.isset("one-partition"),
522
- cmdline.isset("one-event-per-cycle"),
523
- cmdline.isset("my-events"),
524
- unwind_loops);
525
- #endif
548
+ cmdline.isset (" scc" ),
549
+ options.get_int_option (" event-strategy" ),
550
+ unwind_loops,
551
+ !cmdline.isset (" cfg-kill" ),
552
+ cmdline.isset (" no-dependencies" ),
553
+ max_var,
554
+ max_po_trans,
555
+ !cmdline.isset (" no-po-rendering" ),
556
+ cmdline.isset (" render-cluster-file" ),
557
+ cmdline.isset (" render-cluster-function" ),
558
+ cmdline.isset (" cav11" ));
526
559
}
527
560
528
561
if (cmdline.isset (" pso" ))
529
562
{
530
- #if 0
531
563
status (" Adding weak memory (PSO) Instrumentation" );
532
564
weak_memory (
533
565
PSO,
534
566
value_set_analysis,
535
567
context,
536
568
goto_functions,
537
- cmdline.isset("one-partition"),
538
- cmdline.isset("one-event-per-cycle"),
539
- cmdline.isset("my-events"),
540
- unwind_loops);
541
- #endif
569
+ cmdline.isset (" scc" ),
570
+ options.get_int_option (" event-strategy" ),
571
+ unwind_loops,
572
+ !cmdline.isset (" cfg-kill" ),
573
+ cmdline.isset (" no-dependencies" ),
574
+ max_var,
575
+ max_po_trans,
576
+ !cmdline.isset (" no-po-rendering" ),
577
+ cmdline.isset (" render-cluster-file" ),
578
+ cmdline.isset (" render-cluster-function" ),
579
+ cmdline.isset (" cav11" ));
542
580
}
543
581
544
582
if (cmdline.isset (" rmo" ))
545
583
{
546
- #if 0
547
584
status (" Adding weak memory (RMO) Instrumentation" );
548
585
weak_memory (
549
586
RMO,
550
587
value_set_analysis,
551
588
context,
552
589
goto_functions,
553
- cmdline.isset("one-partition"),
554
- cmdline.isset("one-event-per-cycle"),
555
- cmdline.isset("my-events"),
556
- unwind_loops);
557
- #endif
590
+ cmdline.isset (" scc" ),
591
+ options.get_int_option (" event-strategy" ),
592
+ unwind_loops,
593
+ !cmdline.isset (" cfg-kill" ),
594
+ cmdline.isset (" no-dependencies" ),
595
+ max_var,
596
+ max_po_trans,
597
+ !cmdline.isset (" no-po-rendering" ),
598
+ cmdline.isset (" render-cluster-file" ),
599
+ cmdline.isset (" render-cluster-function" ),
600
+ cmdline.isset (" cav11" ));
558
601
}
559
602
560
603
if (cmdline.isset (" power" ))
561
604
{
562
- #if 0
563
605
status (" Adding weak memory (Power) Instrumentation" );
564
606
weak_memory (
565
607
POWER,
566
608
value_set_analysis,
567
609
context,
568
610
goto_functions,
569
- cmdline.isset("one-partition"),
570
- cmdline.isset("one-event-per-cycle"),
571
- cmdline.isset("my-events"),
572
- unwind_loops);
573
- #endif
611
+ cmdline.isset (" scc" ),
612
+ options.get_int_option (" event-strategy" ),
613
+ unwind_loops,
614
+ !cmdline.isset (" cfg-kill" ),
615
+ cmdline.isset (" no-dependencies" ),
616
+ max_var,
617
+ max_po_trans,
618
+ !cmdline.isset (" no-po-rendering" ),
619
+ cmdline.isset (" render-cluster-file" ),
620
+ cmdline.isset (" render-cluster-function" ),
621
+ cmdline.isset (" cav11" ));
574
622
}
575
623
576
624
// Interrupt handler
@@ -602,7 +650,6 @@ void goto_instrument_parseoptionst::instrument_goto_program(
602
650
context,
603
651
goto_functions);
604
652
}
605
-
606
653
}
607
654
608
655
// add failed symbols
@@ -691,9 +738,26 @@ void goto_instrument_parseoptionst::help()
691
738
" \n "
692
739
" Semantic transformations:\n "
693
740
" --nondet-volatile makes reads from volatile variables non-deterministic\n "
741
+ " --unwind <n> unwinds the loops <n> times\n "
694
742
" --isr function instruments an interrupt service routine\n "
695
743
" --mmio instruments memory-mapped I/O\n "
696
744
" --nondet-static add nondeterministic initialization of variables with static lifetime\n "
745
+ " --check-invariant function instruments invariant checking function\n "
746
+ " \n "
747
+ " Memory model instrumentations:\n "
748
+ " --tso instruments weak memory models with buffers (TSO)\n "
749
+ " --pso instruments weak memory models with buffers (PSO)\n "
750
+ " --rmo instruments weak memory models with buffers (RMO)\n "
751
+ " --power instruments weak memory models with buffers and cache (Power)\n "
752
+ " --scc detects critical cycles per SCC (one thread per SCC)\n "
753
+ " --one-event-per-cycle only instruments one event per cycle\n "
754
+ " --minimum-interference instruments an optimal number of events\n "
755
+ " --my-events only instruments the events whose ids appear in inst.evt\n "
756
+ " --cfg-kill enables symbolic execution used to reduce spurious cycles\n "
757
+ " --no-dependencies no dependency analysis\n "
758
+ " --no-po-rendering no representation of the threads in the dot\n "
759
+ " --render-cluster-file clusterises the dot into files of the program"
760
+ " --render-cluster-function clusterises the dot into functions of the program"
697
761
" \n "
698
762
" Slicing:\n "
699
763
" --reachability-slicer slice away instructions that can't reach assertions\n "
0 commit comments