Factor predicate expression types into a separate file
[c11tester.git] / include / predicatetypes.h
1 /**
2  * @file predicatetypes.h
3  * @brief Define common predicate expression types
4  */
5
6 #ifndef __PREDICATE_TYPES_H__
7 #define __PREDICATE_TYPES_H__
8
9 typedef enum predicate_token {
10         NOPREDICATE, EQUALITY, NULLITY
11 } token_t;
12
13 /* If token is EQUALITY, then the predicate asserts whether
14  * this load should read the same value as the last value
15  * read at memory location specified in predicate_expr.
16  */
17 struct pred_expr {
18         pred_expr(token_t token, FuncInst * inst, bool value) :
19                 token(token),
20                 func_inst(inst),
21                 value(value)
22         {}
23
24         token_t token;
25         FuncInst * func_inst;
26         bool value;
27
28         MEMALLOC
29 };
30
31 /* Used by FuncNode to generate Predicates */
32 struct half_pred_expr {
33         half_pred_expr(token_t token, FuncInst * inst) :
34                 token(token),
35                 func_inst(inst)
36         {}
37
38         token_t token;
39         FuncInst * func_inst;
40
41         SNAPSHOTALLOC
42 };
43
44 struct concrete_pred_expr {
45         concrete_pred_expr(token_t token, uint64_t value, bool equality) :
46                 token(token),
47                 value(value),
48                 equality(equality)
49         {}
50
51         token_t token;
52         uint64_t value;
53         bool equality;
54
55         SNAPSHOTALLOC
56 };
57
58 #endif  /* __PREDICATE_TYPES_H__ */
59