@@ -107,9 +107,8 @@ void remove_asmt::gcc_asm_function_call(
107
107
108
108
code_function_callt function_call (std::move (fkt), std::move (arguments));
109
109
110
- goto_programt::targett call = dest.add_instruction (FUNCTION_CALL);
111
- call->code = function_call;
112
- call->source_location = code.source_location ();
110
+ dest.add (
111
+ goto_programt::make_function_call (function_call, code.source_location ()));
113
112
114
113
// do we have it?
115
114
if (!symbol_table.has_symbol (function_identifier))
@@ -157,9 +156,8 @@ void remove_asmt::msc_asm_function_call(
157
156
158
157
code_function_callt function_call (fkt);
159
158
160
- goto_programt::targett call = dest.add_instruction (FUNCTION_CALL);
161
- call->code = function_call;
162
- call->source_location = code.source_location ();
159
+ dest.add (
160
+ goto_programt::make_function_call (function_call, code.source_location ()));
163
161
164
162
// do we have it?
165
163
if (!symbol_table.has_symbol (function_identifier))
@@ -194,7 +192,7 @@ void remove_asmt::process_instruction(
194
192
goto_programt::instructiont &instruction,
195
193
goto_programt &dest)
196
194
{
197
- const code_asmt &code = to_code_asm (instruction.code );
195
+ const code_asmt &code = to_code_asm (instruction.get_other () );
198
196
199
197
const irep_idt &flavor = code.get_flavor ();
200
198
@@ -271,14 +269,15 @@ void remove_asmt::process_instruction_gcc(
271
269
goto_programt::targett ab = tmp_dest.add_instruction (ATOMIC_BEGIN);
272
270
ab->source_location = code.source_location ();
273
271
274
- goto_programt::targett t = tmp_dest.add_instruction (OTHER);
275
- t->source_location = code.source_location ();
276
- t->code = codet (ID_fence);
277
- t->code .add_source_location () = code.source_location ();
278
- t->code .set (ID_WWfence, true );
279
- t->code .set (ID_RRfence, true );
280
- t->code .set (ID_RWfence, true );
281
- t->code .set (ID_WRfence, true );
272
+ codet code_fence (ID_fence);
273
+ code_fence.add_source_location () = code.source_location ();
274
+ code_fence.set (ID_WWfence, true );
275
+ code_fence.set (ID_RRfence, true );
276
+ code_fence.set (ID_RWfence, true );
277
+ code_fence.set (ID_WRfence, true );
278
+
279
+ tmp_dest.add (
280
+ goto_programt::make_other (code_fence, code.source_location ()));
282
281
}
283
282
284
283
if (command == " fstcw" || command == " fnstcw" || command == " fldcw" ) // x86
@@ -292,62 +291,67 @@ void remove_asmt::process_instruction_gcc(
292
291
}
293
292
else if (command == ID_sync) // Power
294
293
{
295
- goto_programt::targett t = tmp_dest.add_instruction (OTHER);
296
- t->source_location = code.source_location ();
297
- t->code = codet (ID_fence);
298
- t->code .add_source_location () = code.source_location ();
299
- t->code .set (ID_WWfence, true );
300
- t->code .set (ID_RRfence, true );
301
- t->code .set (ID_RWfence, true );
302
- t->code .set (ID_WRfence, true );
303
- t->code .set (ID_WWcumul, true );
304
- t->code .set (ID_RWcumul, true );
305
- t->code .set (ID_RRcumul, true );
306
- t->code .set (ID_WRcumul, true );
294
+ codet code_fence (ID_fence);
295
+ code_fence.add_source_location () = code.source_location ();
296
+ code_fence.set (ID_WWfence, true );
297
+ code_fence.set (ID_RRfence, true );
298
+ code_fence.set (ID_RWfence, true );
299
+ code_fence.set (ID_WRfence, true );
300
+ code_fence.set (ID_WWcumul, true );
301
+ code_fence.set (ID_RWcumul, true );
302
+ code_fence.set (ID_RRcumul, true );
303
+ code_fence.set (ID_WRcumul, true );
304
+
305
+ tmp_dest.add (
306
+ goto_programt::make_other (code_fence, code.source_location ()));
307
307
}
308
308
else if (command == ID_lwsync) // Power
309
309
{
310
- goto_programt::targett t = tmp_dest.add_instruction (OTHER);
311
- t->source_location = code.source_location ();
312
- t->code = codet (ID_fence);
313
- t->code .add_source_location () = code.source_location ();
314
- t->code .set (ID_WWfence, true );
315
- t->code .set (ID_RRfence, true );
316
- t->code .set (ID_RWfence, true );
317
- t->code .set (ID_WWcumul, true );
318
- t->code .set (ID_RWcumul, true );
319
- t->code .set (ID_RRcumul, true );
310
+ codet code_fence (ID_fence);
311
+ code_fence.add_source_location () = code.source_location ();
312
+ code_fence.set (ID_WWfence, true );
313
+ code_fence.set (ID_RRfence, true );
314
+ code_fence.set (ID_RWfence, true );
315
+ code_fence.set (ID_WWcumul, true );
316
+ code_fence.set (ID_RWcumul, true );
317
+ code_fence.set (ID_RRcumul, true );
318
+
319
+ tmp_dest.add (
320
+ goto_programt::make_other (code_fence, code.source_location ()));
320
321
}
321
322
else if (command == ID_isync) // Power
322
323
{
323
- goto_programt::targett t = tmp_dest.add_instruction (OTHER);
324
- t->source_location = code.source_location ();
325
- t->code = codet (ID_fence);
326
- t->code .add_source_location () = code.source_location ();
324
+ codet code_fence (ID_fence);
325
+ code_fence.add_source_location () = code.source_location ();
326
+
327
+ tmp_dest.add (
328
+ goto_programt::make_other (code_fence, code.source_location ()));
327
329
// doesn't do anything by itself,
328
330
// needs to be combined with branch
329
331
}
330
332
else if (command == " dmb" || command == " dsb" ) // ARM
331
333
{
332
- goto_programt::targett t = tmp_dest.add_instruction (OTHER);
333
- t->source_location = code.source_location ();
334
- t->code = codet (ID_fence);
335
- t->code .add_source_location () = code.source_location ();
336
- t->code .set (ID_WWfence, true );
337
- t->code .set (ID_RRfence, true );
338
- t->code .set (ID_RWfence, true );
339
- t->code .set (ID_WRfence, true );
340
- t->code .set (ID_WWcumul, true );
341
- t->code .set (ID_RWcumul, true );
342
- t->code .set (ID_RRcumul, true );
343
- t->code .set (ID_WRcumul, true );
334
+ codet code_fence (ID_fence);
335
+ code_fence.add_source_location () = code.source_location ();
336
+ code_fence.set (ID_WWfence, true );
337
+ code_fence.set (ID_RRfence, true );
338
+ code_fence.set (ID_RWfence, true );
339
+ code_fence.set (ID_WRfence, true );
340
+ code_fence.set (ID_WWcumul, true );
341
+ code_fence.set (ID_RWcumul, true );
342
+ code_fence.set (ID_RRcumul, true );
343
+ code_fence.set (ID_WRcumul, true );
344
+
345
+ tmp_dest.add (
346
+ goto_programt::make_other (code_fence, code.source_location ()));
344
347
}
345
348
else if (command == " isb" ) // ARM
346
349
{
347
- goto_programt::targett t = tmp_dest.add_instruction (OTHER);
348
- t->source_location = code.source_location ();
349
- t->code = codet (ID_fence);
350
- t->code .add_source_location () = code.source_location ();
350
+ codet code_fence (ID_fence);
351
+ code_fence.add_source_location () = code.source_location ();
352
+
353
+ tmp_dest.add (
354
+ goto_programt::make_other (code_fence, code.source_location ()));
351
355
// doesn't do anything by itself,
352
356
// needs to be combined with branch
353
357
}
@@ -436,14 +440,15 @@ void remove_asmt::process_instruction_msc(
436
440
goto_programt::targett ab = tmp_dest.add_instruction (ATOMIC_BEGIN);
437
441
ab->source_location = code.source_location ();
438
442
439
- goto_programt::targett t = tmp_dest.add_instruction (OTHER);
440
- t->source_location = code.source_location ();
441
- t->code = codet (ID_fence);
442
- t->code .add_source_location () = code.source_location ();
443
- t->code .set (ID_WWfence, true );
444
- t->code .set (ID_RRfence, true );
445
- t->code .set (ID_RWfence, true );
446
- t->code .set (ID_WRfence, true );
443
+ codet code_fence (ID_fence);
444
+ code_fence.add_source_location () = code.source_location ();
445
+ code_fence.set (ID_WWfence, true );
446
+ code_fence.set (ID_RRfence, true );
447
+ code_fence.set (ID_RWfence, true );
448
+ code_fence.set (ID_WRfence, true );
449
+
450
+ tmp_dest.add (
451
+ goto_programt::make_other (code_fence, code.source_location ()));
447
452
}
448
453
449
454
if (command == " fstcw" || command == " fnstcw" || command == " fldcw" ) // x86
0 commit comments