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