11
11
12
12
#include " symex_target_equation.h"
13
13
14
+ #include < util/format.h>
15
+ #include < util/format_expr.h>
14
16
#include < util/std_expr.h>
15
17
#include < util/throw_with_nested.h>
16
18
#include < util/unwrap_nested_exception.h>
17
19
20
+ // Can be removed once deprecated SSA_stept::output is removed
18
21
#include < langapi/language_util.h>
22
+
19
23
#include < solvers/flattening/bv_conversion_exceptions.h>
20
24
#include < solvers/prop/literal_expr.h>
21
25
#include < solvers/prop/prop.h>
@@ -423,7 +427,7 @@ void symex_target_equationt::convert_decls(
423
427
{
424
428
util_throw_with_nested (
425
429
equation_conversion_exceptiont (
426
- " Error converting decls for step" , step, ns ));
430
+ " Error converting decls for step" , step));
427
431
}
428
432
}
429
433
}
@@ -448,7 +452,7 @@ void symex_target_equationt::convert_guards(
448
452
{
449
453
util_throw_with_nested (
450
454
equation_conversion_exceptiont (
451
- " Error converting guard for step" , step, ns ));
455
+ " Error converting guard for step" , step));
452
456
}
453
457
}
454
458
}
@@ -475,7 +479,7 @@ void symex_target_equationt::convert_assumptions(
475
479
{
476
480
util_throw_with_nested (
477
481
equation_conversion_exceptiont (
478
- " Error converting assumptions for step" , step, ns ));
482
+ " Error converting assumptions for step" , step));
479
483
}
480
484
}
481
485
}
@@ -503,7 +507,7 @@ void symex_target_equationt::convert_goto_instructions(
503
507
{
504
508
util_throw_with_nested (
505
509
equation_conversion_exceptiont (
506
- " Error converting goto instructions for step" , step, ns ));
510
+ " Error converting goto instructions for step" , step));
507
511
}
508
512
}
509
513
}
@@ -582,7 +586,7 @@ void symex_target_equationt::convert_assertions(
582
586
{
583
587
util_throw_with_nested (
584
588
equation_conversion_exceptiont (
585
- " Error converting assertions for step" , step, ns ));
589
+ " Error converting assertions for step" , step));
586
590
}
587
591
588
592
// store disjunct
@@ -767,3 +771,101 @@ void symex_target_equationt::SSA_stept::output(
767
771
768
772
out << " Guard: " << from_expr (ns, source.pc ->function , guard) << ' \n ' ;
769
773
}
774
+
775
+ void symex_target_equationt::SSA_stept::output (std::ostream &out) const
776
+ {
777
+ if (source.is_set )
778
+ {
779
+ out << " Thread " << source.thread_nr ;
780
+
781
+ if (source.pc ->source_location .is_not_nil ())
782
+ out << " " << source.pc ->source_location << ' \n ' ;
783
+ else
784
+ out << ' \n ' ;
785
+ }
786
+
787
+ switch (type)
788
+ {
789
+ case goto_trace_stept::typet::ASSERT:
790
+ out << " ASSERT " << format (cond_expr) << ' \n ' ; break ;
791
+ case goto_trace_stept::typet::ASSUME:
792
+ out << " ASSUME " << format (cond_expr) << ' \n ' ; break ;
793
+ case goto_trace_stept::typet::LOCATION:
794
+ out << " LOCATION" << ' \n ' ; break ;
795
+ case goto_trace_stept::typet::INPUT:
796
+ out << " INPUT" << ' \n ' ; break ;
797
+ case goto_trace_stept::typet::OUTPUT:
798
+ out << " OUTPUT" << ' \n ' ; break ;
799
+
800
+ case goto_trace_stept::typet::DECL:
801
+ out << " DECL" << ' \n ' ;
802
+ out << format (ssa_lhs) << ' \n ' ;
803
+ break ;
804
+
805
+ case goto_trace_stept::typet::ASSIGNMENT:
806
+ out << " ASSIGNMENT (" ;
807
+ switch (assignment_type)
808
+ {
809
+ case assignment_typet::HIDDEN:
810
+ out << " HIDDEN" ;
811
+ break ;
812
+ case assignment_typet::STATE:
813
+ out << " STATE" ;
814
+ break ;
815
+ case assignment_typet::VISIBLE_ACTUAL_PARAMETER:
816
+ out << " VISIBLE_ACTUAL_PARAMETER" ;
817
+ break ;
818
+ case assignment_typet::HIDDEN_ACTUAL_PARAMETER:
819
+ out << " HIDDEN_ACTUAL_PARAMETER" ;
820
+ break ;
821
+ case assignment_typet::PHI:
822
+ out << " PHI" ;
823
+ break ;
824
+ case assignment_typet::GUARD:
825
+ out << " GUARD" ;
826
+ break ;
827
+ default :
828
+ {
829
+ }
830
+ }
831
+
832
+ out << " )\n " ;
833
+ break ;
834
+
835
+ case goto_trace_stept::typet::DEAD:
836
+ out << " DEAD\n " ; break ;
837
+ case goto_trace_stept::typet::FUNCTION_CALL:
838
+ out << " FUNCTION_CALL\n " ; break ;
839
+ case goto_trace_stept::typet::FUNCTION_RETURN:
840
+ out << " FUNCTION_RETURN\n " ; break ;
841
+ case goto_trace_stept::typet::CONSTRAINT:
842
+ out << " CONSTRAINT\n " ; break ;
843
+ case goto_trace_stept::typet::SHARED_READ:
844
+ out << " SHARED READ\n " ; break ;
845
+ case goto_trace_stept::typet::SHARED_WRITE:
846
+ out << " SHARED WRITE\n " ; break ;
847
+ case goto_trace_stept::typet::ATOMIC_BEGIN:
848
+ out << " ATOMIC_BEGIN\n " ; break ;
849
+ case goto_trace_stept::typet::ATOMIC_END:
850
+ out << " AUTOMIC_END\n " ; break ;
851
+ case goto_trace_stept::typet::SPAWN:
852
+ out << " SPAWN\n " ; break ;
853
+ case goto_trace_stept::typet::MEMORY_BARRIER:
854
+ out << " MEMORY_BARRIER\n " ; break ;
855
+ case goto_trace_stept::typet::GOTO:
856
+ out << " IF " << format (cond_expr) << " GOTO\n " ; break ;
857
+
858
+ default : UNREACHABLE;
859
+ }
860
+
861
+ if (is_assert () || is_assume () || is_assignment () || is_constraint ())
862
+ out << format (cond_expr) << ' \n ' ;
863
+
864
+ if (is_assert () || is_constraint ())
865
+ out << comment << ' \n ' ;
866
+
867
+ if (is_shared_read () || is_shared_write ())
868
+ out << format (ssa_lhs) << ' \n ' ;
869
+
870
+ out << " Guard: " << format (guard) << ' \n ' ;
871
+ }
0 commit comments