@@ -210,6 +210,7 @@ void symex_target_equationt::location(
210210void symex_target_equationt::function_call (
211211 const exprt &guard,
212212 const irep_idt &function_identifier,
213+ const std::vector<exprt> &ssa_function_arguments,
213214 const sourcet &source)
214215{
215216 SSA_steps.push_back (SSA_stept ());
@@ -219,6 +220,7 @@ void symex_target_equationt::function_call(
219220 SSA_step.type = goto_trace_stept::typet::FUNCTION_CALL;
220221 SSA_step.source = source;
221222 SSA_step.function_identifier = function_identifier;
223+ SSA_step.ssa_function_arguments = ssa_function_arguments;
222224
223225 merge_ireps (SSA_step);
224226}
@@ -383,6 +385,7 @@ void symex_target_equationt::convert(
383385 convert_assumptions (prop_conv);
384386 convert_assertions (prop_conv);
385387 convert_goto_instructions (prop_conv);
388+ convert_function_calls (prop_conv);
386389 convert_io (prop_conv);
387390 convert_constraints (prop_conv);
388391 }
@@ -658,6 +661,39 @@ void symex_target_equationt::convert_assertions(
658661 prop_conv.set_to_true (disjunction (disjuncts));
659662}
660663
664+ // / converts function calls
665+ // / \par parameters: decision procedure
666+ // / \return -
667+ void symex_target_equationt::convert_function_calls (
668+ decision_proceduret &dec_proc)
669+ {
670+ std::size_t argument_count=0 ;
671+
672+ for (auto &step : SSA_steps)
673+ if (!step.ignore )
674+ {
675+ step.converted_function_arguments .reserve (step.ssa_function_arguments .size ());
676+
677+ for (const auto &arg : step.ssa_function_arguments )
678+ {
679+ if (arg.is_constant () ||
680+ arg.id ()==ID_string_constant)
681+ step.converted_function_arguments .push_back (arg);
682+ else
683+ {
684+ const irep_idt identifier=" symex::args::" +std::to_string (argument_count++);
685+ symbol_exprt symbol (identifier, arg.type ());
686+
687+ equal_exprt eq (arg, symbol);
688+ merge_irep (eq);
689+
690+ dec_proc.set_to (eq, true );
691+ step.converted_function_arguments .push_back (symbol);
692+ }
693+ }
694+ }
695+ }
696+
661697// / converts I/O
662698// / \par parameters: decision procedure
663699// / \return -
@@ -690,7 +726,6 @@ void symex_target_equationt::convert_io(
690726 }
691727}
692728
693-
694729void symex_target_equationt::merge_ireps (SSA_stept &SSA_step)
695730{
696731 merge_irep (SSA_step.guard );
@@ -705,6 +740,9 @@ void symex_target_equationt::merge_ireps(SSA_stept &SSA_step)
705740 for (auto &step : SSA_step.io_args )
706741 merge_irep (step);
707742
743+ for (auto &arg : SSA_step.ssa_function_arguments )
744+ merge_irep (arg);
745+
708746 // converted_io_args is merged in convert_io
709747}
710748
0 commit comments