Skip to content

Commit 5f97793

Browse files
committed
output_instruction now nicely formats output statements
This is a cosmetic change to the formatter for goto-instruction output statements.
1 parent 68cbf7a commit 5f97793

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

src/goto-programs/goto_program.cpp

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,56 @@ std::ostream &goto_programt::output_instruction(
121121
if(instruction.get_other().id() == ID_code)
122122
{
123123
const auto &code = instruction.get_other();
124-
if(code.get_statement() == ID_havoc_object)
124+
if(code.get_statement() == ID_array_copy)
125+
{
126+
out << "ARRAY_COPY " << format(code.op0()) << ' ' << format(code.op1())
127+
<< '\n';
128+
break;
129+
}
130+
else if(code.get_statement() == ID_array_replace)
131+
{
132+
out << "ARRAY_REPLACE " << format(code.op0()) << ' '
133+
<< format(code.op1()) << '\n';
134+
break;
135+
}
136+
else if(code.get_statement() == ID_array_set)
137+
{
138+
out << "ARRAY_SET " << format(code.op0()) << ' ' << format(code.op1())
139+
<< '\n';
140+
break;
141+
}
142+
else if(code.get_statement() == ID_havoc_object)
125143
{
126144
out << "HAVOC_OBJECT " << format(code.op0()) << '\n';
127145
break;
128146
}
147+
else if(code.get_statement() == ID_fence)
148+
{
149+
out << "FENCE";
150+
if(code.get_bool(ID_WWfence))
151+
out << " WW";
152+
if(code.get_bool(ID_RRfence))
153+
out << " RR";
154+
if(code.get_bool(ID_RWfence))
155+
out << " RW";
156+
if(code.get_bool(ID_WRfence))
157+
out << " WR";
158+
out << '\n';
159+
break;
160+
}
161+
else if(code.get_statement() == ID_input)
162+
{
163+
out << "INPUT";
164+
for(const auto &op : code.operands())
165+
out << ' ' << format(op);
166+
out << '\n';
167+
break;
168+
}
169+
else if(code.get_statement() == ID_output)
170+
{
171+
out << "OUTPUT " << format(code.op0()) << '\n';
172+
break;
173+
}
129174
// fallthrough
130175
}
131176

0 commit comments

Comments
 (0)