1 /** @file libinterface.h
2 * @brief Interface to check normal memory operations for data races.
5 #ifndef __LIBINTERFACE_H__
6 #define __LIBINTERFACE_H__
13 typedef unsigned int MCID;
14 #define MC2_PTR_LENGTH sizeof(void *)
16 #define MCID_NODEP ((MCID)0)
17 #define MCID_INIT ((MCID)0)
18 #define MCID_FIRST ((MCID)1)
20 #define MC2_OFFSET(x, y) (uintptr_t)(&((x)(0))->y)
22 void store_8(void *addr, uint8_t val);
23 void store_16(void *addr, uint16_t val);
24 void store_32(void *addr, uint32_t val);
25 void store_64(void *addr, uint64_t val);
27 uint8_t load_8(const void *addr);
28 uint16_t load_16(const void *addr);
29 uint32_t load_32(const void *addr);
30 uint64_t load_64(const void *addr);
38 uint8_t rmw_8(enum atomicop op, void *addr, uint8_t oldval, uint8_t valarg);
39 uint16_t rmw_16(enum atomicop op, void *addr, uint16_t oldval, uint16_t valarg);
40 uint32_t rmw_32(enum atomicop op, void *addr, uint32_t oldval, uint32_t valarg);
41 uint64_t rmw_64(enum atomicop op, void *addr, uint64_t oldval, uint64_t valarg);
42 MCID MC2_nextRMW(MCID addr, MCID oldval, MCID valarg);
44 MCID MC2_nextOpLoad(MCID addr);
45 void MC2_nextOpStore(MCID addr, MCID value);
47 MCID MC2_nextRMWOffset(MCID addr, uintptr_t offset, MCID oldval, MCID valarg);
49 MCID MC2_nextOpLoadOffset(MCID addr, uintptr_t offset);
50 void MC2_nextOpStoreOffset(MCID addr, uintptr_t offset, MCID value);
51 MCID MC2_branchUsesID(MCID condition, int direction, int num_directions, bool anyvalue);
52 void MC2_nextOpThrd_create(MCID startfunc, MCID param);
53 void MC2_nextOpThrd_join(MCID jointhrd);
55 void MC2_merge(MCID branchid);
56 MCID MC2_function(unsigned int num_args, int numbytesretval, uint64_t val, ...);
57 MCID MC2_function_id(unsigned int id, unsigned int num_args, int numbytesretval, uint64_t val, ...);
58 uint64_t MC2_equals(MCID op1, uint64_t val1, MCID op2, uint64_t val2, MCID *retval);
60 MCID MC2_phi(MCID input);
61 MCID MC2_loop_phi(MCID input);
67 void MC2_loopIterate();
72 #endif /* __LIBINTERFACE_H__ */