aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ptrmap.h
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-25 14:29:48 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-25 14:55:25 +0200
commit96f388f0f55cfa1984daa70d7dc4faa63a85c590 (patch)
tree5a8af02749000a8228f4d8f68720f088356faef6 /ptrmap.h
parentd46b7b2f9fc4769d8dce72913bfac370f1d69df5 (diff)
parent3f06ccfcc0be01c0d5bc6a982c2fbadf62fa502a (diff)
downloadsparse-dev-96f388f0f55cfa1984daa70d7dc4faa63a85c590.tar.gz
Merge branch 'ssa' into tip
* do 'classical' SSA conversion (via the iterated dominance frontier). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'ptrmap.h')
-rw-r--r--ptrmap.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/ptrmap.h b/ptrmap.h
new file mode 100644
index 00000000..cbbb61da
--- /dev/null
+++ b/ptrmap.h
@@ -0,0 +1,28 @@
+#ifndef PTRMAP_H
+#define PTRMAP_H
+
+struct ptrmap;
+
+#define DECLARE_PTRMAP(name, ktype, vtype) \
+ struct name ## _pair { ktype key; vtype val; }; \
+ struct name { struct name ## _pair block[1]; }; \
+ static inline \
+ void name##_add(struct name **map, ktype k, vtype v) { \
+ __ptrmap_add((struct ptrmap**)map, k, v); \
+ } \
+ static inline \
+ void name##_update(struct name **map, ktype k, vtype v) { \
+ __ptrmap_update((struct ptrmap**)map, k, v); \
+ } \
+ static inline \
+ vtype name##_lookup(struct name *map, ktype k) { \
+ vtype val = __ptrmap_lookup((struct ptrmap*)map, k); \
+ return val; \
+ } \
+
+/* ptrmap.c */
+void __ptrmap_add(struct ptrmap **mapp, void *key, void *val);
+void __ptrmap_update(struct ptrmap **mapp, void *key, void *val);
+void *__ptrmap_lookup(struct ptrmap *map, void *key);
+
+#endif