CBMC
weak_memory.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Weak Memory Instrumentation for Threaded Goto Programs
4 
5 Author: Daniel Kroening
6 
7 Date: September 2011
8 
9 \*******************************************************************/
10 
13 
14 #ifndef CPROVER_GOTO_INSTRUMENT_WMM_WEAK_MEMORY_H
15 #define CPROVER_GOTO_INSTRUMENT_WMM_WEAK_MEMORY_H
16 
17 #include "wmm.h"
18 
19 #include <util/irep.h>
20 
21 class symbol_tablet;
22 class value_setst;
23 class goto_modelt;
24 class message_handlert;
25 class goto_programt;
26 class messaget;
27 
28 void weak_memory(
29  memory_modelt model,
30  value_setst &,
31  goto_modelt &,
32  bool SCC,
33  instrumentation_strategyt event_stategy,
34  bool no_cfg_kill,
35  bool no_dependencies,
36  loop_strategyt duplicate_body,
37  unsigned max_var,
38  unsigned max_po_trans,
39  bool render_po,
40  bool render_file,
41  bool render_function,
42  bool cav11_option,
43  bool hide_internals,
45  bool ignore_arrays);
46 
48  value_setst &,
49  symbol_tablet &,
50  const irep_idt &function,
51  goto_programt &,
52 #ifdef LOCAL_MAY
53  const goto_functionst::goto_functiont &goto_function,
54 #endif
55  messaget &message);
56 
57 // clang-format off
58 #define OPT_WMM_MEMORY_MODEL "(mm):"
59 
60 #define OPT_WMM_INSTRUMENTATION_STRATEGIES \
61  "(one-event-per-cycle)" \
62  "(minimum-interference)" \
63  "(read-first)" \
64  "(write-first)" \
65  "(my-events)" \
66 
67 #define OPT_WMM_LIMITS \
68  "(max-var):" \
69  "(max-po-trans):" \
70 
71 #define OPT_WMM_LOOPS \
72  "(force-loop-duplication)" \
73  "(no-loop-duplication)" \
74 
75 #define OPT_WMM_MISC \
76  "(scc)" \
77  "(cfg-kill)" \
78  "(no-dependencies)" \
79  "(no-po-rendering)" \
80  "(render-cluster-file)" \
81  "(render-cluster-function)" \
82  "(cav11)" \
83  "(hide-internals)" \
84  "(ignore-arrays)" \
85 
86 #define OPT_WMM \
87  OPT_WMM_MEMORY_MODEL \
88  OPT_WMM_INSTRUMENTATION_STRATEGIES \
89  OPT_WMM_LIMITS \
90  OPT_WMM_LOOPS \
91  OPT_WMM_MISC \
92 
93 
94 #define HELP_WMM_FULL \
95  " --mm <tso,pso,rmo,power> instruments a weak memory model\n" \
96  " --scc detects critical cycles per SCC (one thread per SCC)\n" /* NOLINT(whitespace/line_length) */ \
97  " --one-event-per-cycle only instruments one event per cycle\n" \
98  " --minimum-interference instruments an optimal number of events\n" \
99  " --my-events only instruments events whose ids appear in inst.evt\n" /* NOLINT(whitespace/line_length) */ \
100  " --read-first|--write-first only instrument cycles where a read or \n" \
101  " write occurs as first event, respectively\n" \
102  " --max-var N limit cycles to N variables read/written\n" \
103  " --max-po-trans N limit cycles to N program-order edges\n" \
104  " --ignore-arrays instrument arrays as a single object\n" \
105  " --cav11 always instrument shared variables, even\n" \
106  " when they are not part of any cycle\n" \
107  " --force-loop-duplication|--no-loop-duplication\n" \
108  " optional program transformation to\n" \
109  " construct cycles in program loops\n" \
110  " --cfg-kill enables symbolic execution used to reduce spurious cycles\n" /* NOLINT(whitespace/line_length) */ \
111  " --no-dependencies no dependency analysis\n" \
112  " --no-po-rendering no representation of the threads in the dot\n"\
113  " --hide-internals do not include thread-internal (Rfi)\n" \
114  " events in dot output\n" \
115  " --render-cluster-file clusterises the dot by files\n" \
116  " --render-cluster-function clusterises the dot by functions\n"
117 
118 // clang-format on
119 
120 #endif // CPROVER_GOTO_INSTRUMENT_WMM_WEAK_MEMORY_H
messaget
Class that provides messages with a built-in verbosity 'level'.
Definition: message.h:154
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
symbol_tablet
The symbol table.
Definition: symbol_table.h:13
weak_memory
void weak_memory(memory_modelt model, value_setst &, goto_modelt &, bool SCC, instrumentation_strategyt event_stategy, bool no_cfg_kill, bool no_dependencies, loop_strategyt duplicate_body, unsigned max_var, unsigned max_po_trans, bool render_po, bool render_file, bool render_function, bool cav11_option, bool hide_internals, message_handlert &, bool ignore_arrays)
Definition: weak_memory.cpp:107
goto_modelt
Definition: goto_model.h:25
loop_strategyt
loop_strategyt
Definition: wmm.h:36
introduce_temporaries
void introduce_temporaries(value_setst &, symbol_tablet &, const irep_idt &function, goto_programt &, messaget &message)
all access to shared variables is pushed into assignments
Definition: weak_memory.cpp:38
message_handlert
Definition: message.h:27
memory_modelt
memory_modelt
Definition: wmm.h:17
goto_functionst::goto_functiont
::goto_functiont goto_functiont
Definition: goto_functions.h:27
value_setst
Definition: value_sets.h:21
goto_programt
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:72
instrumentation_strategyt
instrumentation_strategyt
Definition: wmm.h:26
wmm.h
irep.h