Skip to content

Commit b1c61dc

Browse files
author
martin
committed
OPT_ and HELP_ macros for the weak memory model flags
This also adds: --read-first --write-first --no-loop-duplication --hide-internals which are handled by goto-instrument but were not options so couldn't be used.
1 parent 6fb3bff commit b1c61dc

File tree

3 files changed

+55
-19
lines changed

3 files changed

+55
-19
lines changed

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ Author: Daniel Kroening, [email protected]
110110
#include "unwind.h"
111111
#include "unwindset.h"
112112
#include "value_set_fi_fp_removal.h"
113-
#include "wmm/weak_memory.h"
114113

115114
/// invoke main modules
116115
int goto_instrument_parse_optionst::doit()
@@ -1793,17 +1792,7 @@ void goto_instrument_parse_optionst::help()
17931792
" --skip-loops <loop-ids> add gotos to skip selected loops during execution\n" // NOLINT(*)
17941793
"\n"
17951794
"Memory model instrumentations:\n"
1796-
" --mm <tso,pso,rmo,power> instruments a weak memory model\n"
1797-
" --scc detects critical cycles per SCC (one thread per SCC)\n" // NOLINT(*)
1798-
" --one-event-per-cycle only instruments one event per cycle\n"
1799-
" --minimum-interference instruments an optimal number of events\n"
1800-
" --my-events only instruments events whose ids appear in inst.evt\n" // NOLINT(*)
1801-
" --cfg-kill enables symbolic execution used to reduce spurious cycles\n" // NOLINT(*)
1802-
" --no-dependencies no dependency analysis\n"
1803-
// NOLINTNEXTLINE(whitespace/line_length)
1804-
" --no-po-rendering no representation of the threads in the dot\n"
1805-
" --render-cluster-file clusterises the dot by files\n"
1806-
" --render-cluster-function clusterises the dot by functions\n"
1795+
HELP_WMM_FULL
18071796
"\n"
18081797
"Slicing:\n"
18091798
HELP_REACHABILITY_SLICER

src/goto-instrument/goto_instrument_parse_options.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Author: Daniel Kroening, [email protected]
4040
#include "nondet_volatile.h"
4141
#include "replace_calls.h"
4242
#include "uninitialized.h"
43+
#include "wmm/weak_memory.h"
4344

4445
// clang-format off
4546
#define GOTO_INSTRUMENT_OPTIONS \
@@ -50,18 +51,14 @@ Author: Daniel Kroening, [email protected]
5051
OPT_REMOVE_POINTERS \
5152
"(no-simplify)" \
5253
OPT_UNINITIALIZED_CHECK \
53-
"(race-check)(scc)(one-event-per-cycle)" \
54-
"(minimum-interference)" \
55-
"(mm):(my-events)" \
54+
OPT_WMM \
55+
"(race-check)" \
5656
"(unwind):(unwindset):(unwindset-file):" \
5757
"(unwinding-assertions)(partial-loops)(continue-as-loops)" \
5858
"(log):" \
59-
"(max-var):(max-po-trans):(ignore-arrays)" \
60-
"(cfg-kill)(no-dependencies)(force-loop-duplication)" \
6159
"(call-graph)(reachable-call-graph)" \
6260
OPT_INSERT_FINAL_ASSERT_FALSE \
6361
OPT_SHOW_CLASS_HIERARCHY \
64-
"(no-po-rendering)(render-cluster-file)(render-cluster-function)" \
6562
"(isr):" \
6663
"(stack-depth):(nondet-static)" \
6764
"(nondet-static-exclude):" \
@@ -85,7 +82,6 @@ Author: Daniel Kroening, [email protected]
8582
"(remove-function-pointers)" \
8683
"(show-claims)(property):" \
8784
"(show-symbol-table)(show-points-to)(show-rw-set)" \
88-
"(cav11)" \
8985
OPT_TIMESTAMP \
9086
"(show-natural-loops)(show-lexical-loops)(accelerate)(havoc-loops)" \
9187
"(string-abstraction)" \

src/goto-instrument/wmm/weak_memory.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,55 @@ void introduce_temporaries(
5454
#endif
5555
messaget &message);
5656

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+
" --cfg-kill enables symbolic execution used to reduce spurious cycles\n" /* NOLINT(whitespace/line_length) */ \
101+
" --no-dependencies no dependency analysis\n" \
102+
" --no-po-rendering no representation of the threads in the dot\n"\
103+
" --render-cluster-file clusterises the dot by files\n" \
104+
" --render-cluster-function clusterises the dot by functions\n"
105+
106+
// clang-format on
107+
57108
#endif // CPROVER_GOTO_INSTRUMENT_WMM_WEAK_MEMORY_H

0 commit comments

Comments
 (0)