Remove unused headers
[c11tester.git] / librace.cc
1 #define __STDC_FORMAT_MACROS
2 #include <inttypes.h>
3
4 #include "librace.h"
5 #include "common.h"
6 #include "datarace.h"
7 #include "model.h"
8 #include "threads-model.h"
9 #include "snapshot-interface.h"
10
11 /**
12  * Helper functions used by CDSPass
13  * The CDSPass implementation does not replace normal load/stores with cds load/stores,
14  * but inserts cds load/stores to check dataraces. Thus, the cds load/stores do not
15  * return anything.
16  */
17
18 void cds_store8(void *addr)
19 {
20         //DEBUG("addr = %p, val = %" PRIu8 "\n", addr, val);
21         if (!model)
22                 return;
23         thread_id_t tid = thread_current_id();
24         raceCheckWrite8(tid, addr);
25 }
26
27 void cds_store16(void *addr)
28 {
29         //DEBUG("addr = %p, val = %" PRIu16 "\n", addr, val);
30         if (!model)
31                 return;
32         thread_id_t tid = thread_current_id();
33         raceCheckWrite16(tid, addr);
34 }
35
36 void cds_store32(void *addr)
37 {
38         //DEBUG("addr = %p, val = %" PRIu32 "\n", addr, val);
39         if (!model)
40                 return;
41         thread_id_t tid = thread_current_id();
42         raceCheckWrite32(tid, addr);
43 }
44
45 void cds_store64(void *addr)
46 {
47         //DEBUG("addr = %p, val = %" PRIu64 "\n", addr, val);
48         if (!model)
49                 return;
50         thread_id_t tid = thread_current_id();
51         raceCheckWrite64(tid, addr);
52 }
53
54 void cds_load8(const void *addr) {
55         DEBUG("addr = %p\n", addr);
56         if (!model)
57                 return;
58         thread_id_t tid = thread_current_id();
59         raceCheckRead8(tid, addr);
60 }
61
62 void cds_load16(const void *addr) {
63         DEBUG("addr = %p\n", addr);
64         if (!model)
65                 return;
66         thread_id_t tid = thread_current_id();
67         raceCheckRead16(tid, addr);
68 }
69
70 void cds_load32(const void *addr) {
71         DEBUG("addr = %p\n", addr);
72         if (!model)
73                 return;
74         thread_id_t tid = thread_current_id();
75         raceCheckRead32(tid, addr);
76 }
77
78 void cds_load64(const void *addr) {
79         DEBUG("addr = %p\n", addr);
80         if (!model)
81                 return;
82         thread_id_t tid = thread_current_id();
83         raceCheckRead64(tid, addr);
84 }