ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#ifndef CPROVER_UTIL_CONFIG_H
2#define CPROVER_UTIL_CONFIG_H
3
4#include <unordered_set>
7#include <langapi/mode.h>
10
22
35
37{
38public:
39 struct triple
40 {
41 std::string arch = "none";
42 std::string vendor = "unknown";
43 std::string os = "elf";
44 std::string flavor;
45
46 bool is_riscv() const;
47 bool is_windows_abi() const;
48 bool is_freebsd() const;
49 bool is_macos() const;
50 bool is_arm() const;
51 std::string to_string() const;
52 };
53
54#define dm(char, short, int, long, addr, word, long_dbl) \
55 ((uint64_t)(char) | (uint64_t)(short) << 8 | (uint64_t)(int) << 16 | \
56 (uint64_t)(long) << 24 | (uint64_t)(addr) << 32 | (uint64_t)(word) << 40 | \
57 (uint64_t)(long_dbl) << 48)
58
59 enum data_model : uint64_t
60 {
61 /* 16-bit */
62 IP16 = dm(8, 16, 16, 32, 16, 16, 64), /* unsegmented 16-bit */
63 LP32 = dm(8, 16, 16, 32, 32, 16, 64), /* segmented 16-bit DOS, Win16 */
64 /* 32-bit */
65 IP32 = dm(8, 16, 32, 64, 32, 32, 96), /* Ultrix '82-'95 */
66 ILP32 = dm(8, 16, 32, 32, 32, 32, 96), /* Win32 || other 32-bit Unix */
67 /* 64-bit */
68 LLP64 = dm(8, 16, 32, 32, 64, 64, 128), /* Win64 */
69 ILP64 = dm(8, 16, 64, 64, 64, 64, 128), /* Unicos for Cray PVP systems */
70 LP64 = dm(8, 16, 32, 64, 64, 64, 128), /* other 64-bit Unix */
71 };
72
73#undef dm
74
75 // Language the frontend has been parsing
77 {
79 std::string std;
80 // Set by the Clang frontend after typecheck().
84
85 struct ansi_ct
86 {
87 // for ANSI-C
88 unsigned int_width;
90 unsigned bool_width;
91 unsigned char_width;
94 unsigned address_width;
95 unsigned single_width;
96 unsigned double_width;
99 unsigned word_size;
101 /* ABI alignment in bytes of 8-byte and wider scalars, as the C frontend's
102 * clang target lays out records (i386: 4, #8694); 0 means the type's size.
103 */
104 unsigned long_long_align = 0;
105 unsigned double_align = 0;
106 unsigned long_double_align = 0;
107 /* Cap on _BitInt alignment in bytes (x86-64: 8, AArch64: 16; #8692). */
108 unsigned bitint_max_align = 0;
109
110 unsigned pointer_width() const noexcept
111 {
113 }
114
115 unsigned int capability_width() const noexcept
116 {
117 return (cheri_concentrate ? 2 : 4) * address_width;
118 }
119
120 // alignment of max_align_t (in bytes)
121 unsigned int max_alignment() const noexcept
122 {
123 // 8 for 32-bit, 16 for 64-bit
124 return word_size * 2 / char_width;
125 }
126
129 bool reserve_first_page = false;
130
137 /* otherwise, uncompressed encoding to quadruple the size of addresses */
139
140 // for fixed size
141 unsigned int_128_width = 128;
142
150
152
154 bool endianess_overrides_target() const;
155
156 /* TODO: make this configurable.
157 *
158 * While it is not, the empty string means that we assume that the given
159 * program uses the same locale as we do ourselves. This is used for
160 * setlocale() in order to interpret string literals, see
161 * string_constantt::mb_value(). Therefore, this gives both, the source and
162 * execution character set. */
163 std::string locale_name;
164
165 std::list<std::string> defines;
166 std::list<std::string> include_files;
167 std::list<std::string> include_paths;
168 std::list<std::string> idirafter_paths;
169 std::list<std::string> forces;
170 std::list<std::string> warnings;
171 std::vector<std::string> frontend_opts;
172
173 typedef enum
174 {
177 } libt;
179
180 void set_data_model(enum data_model dm);
182
183 std::string main;
184 // the name of class/contract/namespace where the function is inside
185 std::string cname;
186 std::unordered_set<std::string> no_slice_names;
187 std::unordered_set<std::string> no_slice_ids;
188
189 bool set(const cmdlinet &cmdline);
190
192
193 static std::string this_architecture();
194 static std::string this_operating_system();
195
196 static triple host();
197
198 std::vector<std::string> args;
199};
200
201extern configt config;
202
213
214#endif
std::unordered_set< assert_pair > assert_db
Definition cache_defs.h:8
Definition cmdline.h:31
Definition config.h:37
optionst options
Definition config.h:191
static std::string this_architecture()
Definition config.cpp:339
data_model
Definition config.h:60
@ IP32
Definition config.h:65
@ ILP64
Definition config.h:69
@ ILP32
Definition config.h:66
@ LP32
Definition config.h:63
@ IP16
Definition config.h:62
@ LLP64
Definition config.h:68
@ LP64
Definition config.h:70
bool set(const cmdlinet &cmdline)
Definition config.cpp:121
std::unordered_set< std::string > no_slice_ids
Definition config.h:187
std::unordered_set< std::string > no_slice_names
Definition config.h:186
static triple host()
Definition config.cpp:450
static std::string this_operating_system()
Definition config.cpp:429
std::vector< std::string > args
Definition config.h:198
struct configt::language_stdt language
std::string main
Definition config.h:183
std::string cname
Definition config.h:185
struct configt::ansi_ct ansi_c
Definition options.h:11
configt config
Definition config.cpp:8
cxx_stdt
C++ standard version, ordered so that comparisons work naturally.
Definition config.h:25
@ cpp14
Definition config.h:29
@ cpp98
Definition config.h:27
@ cpp23
Definition config.h:32
@ cpp20
Definition config.h:31
@ cpp26
Definition config.h:33
@ unknown
Definition config.h:26
@ cpp11
Definition config.h:28
@ cpp17
Definition config.h:30
assert_db & get_ssa_caching_db()
Per-thread SSA assertion cache.
Definition config.cpp:10
#define dm(char, short, int, long, addr, word, long_dbl)
Definition config.h:54
c_stdt
C standard version, ordered so that comparisons work naturally.
Definition config.h:13
@ c17
Definition config.h:18
@ c89
Definition config.h:15
@ c26
Definition config.h:20
@ c99
Definition config.h:16
@ c11
Definition config.h:17
@ unknown
Definition config.h:14
@ c23
Definition config.h:19
language_idt
Definition mode.h:11
@ NONE
Definition mode.h:12
Definition os.py:1
Definition exception.cpp:51
Definition config.h:86
libt lib
Definition config.h:178
std::list< std::string > include_paths
Definition config.h:167
unsigned long_double_width
Definition config.h:97
unsigned int max_alignment() const noexcept
Definition config.h:121
std::string locale_name
Definition config.h:163
unsigned double_width
Definition config.h:96
void set_data_model(enum data_model dm)
Definition config.cpp:18
unsigned single_width
Definition config.h:95
cheri_flavor
Definition config.h:132
@ CHERI_PURECAP
Definition config.h:135
@ CHERI_OFF
Definition config.h:133
@ CHERI_HYBRID
Definition config.h:134
std::list< std::string > idirafter_paths
Definition config.h:168
std::list< std::string > forces
Definition config.h:169
enum configt::ansi_ct::cheri_flavor cheri
std::vector< std::string > frontend_opts
Definition config.h:171
unsigned int_width
Definition config.h:88
unsigned short_int_width
Definition config.h:92
std::list< std::string > include_files
Definition config.h:166
unsigned word_size
Definition config.h:99
unsigned char_width
Definition config.h:91
unsigned int capability_width() const noexcept
Definition config.h:115
bool use_fixed_for_float
Definition config.h:128
libt
Definition config.h:174
@ LIB_FULL
Definition config.h:176
@ LIB_NONE
Definition config.h:175
std::list< std::string > defines
Definition config.h:165
bool reserve_first_page
Definition config.h:129
unsigned wchar_t_width
Definition config.h:100
unsigned long_int_width
Definition config.h:89
endianesst
Definition config.h:144
@ IS_BIG_ENDIAN
Definition config.h:147
@ NO_ENDIANESS
Definition config.h:145
@ IS_LITTLE_ENDIAN
Definition config.h:146
bool cheri_concentrate
Definition config.h:138
unsigned address_width
Definition config.h:94
unsigned long_long_align
Definition config.h:104
triple target
Definition config.h:151
endianesst endianess
Definition config.h:149
unsigned long_long_int_width
Definition config.h:93
std::list< std::string > warnings
Definition config.h:170
unsigned pointer_width() const noexcept
Definition config.h:110
bool endianess_overrides_target() const
Whether –big-endian or –little-endian contradicts the target.
Definition config.cpp:91
bool char_is_unsigned
Definition config.h:127
unsigned long_double_align
Definition config.h:106
unsigned bitint_max_align
Definition config.h:108
unsigned pointer_diff_width
Definition config.h:98
unsigned int_128_width
Definition config.h:141
unsigned double_align
Definition config.h:105
unsigned bool_width
Definition config.h:90
Definition config.h:77
cxx_stdt cpp_std
Definition config.h:82
c_stdt c_std
Definition config.h:81
language_idt lid
Definition config.h:78
Definition config.h:40
bool is_windows_abi() const
Definition config.cpp:96
std::string to_string() const
Definition config.cpp:116
bool is_freebsd() const
Definition config.cpp:101
std::string flavor
Definition config.h:44
bool is_macos() const
Definition config.cpp:106
std::string arch
Definition config.h:41
bool is_riscv() const
Definition config.cpp:62
std::string vendor
Definition config.h:42
bool is_arm() const
Definition config.cpp:111