debug: add __smatch_about(var) to print what smatch knows about a variable
[smatch.git] / storage.h
blobe049e235bd35298ef69f688fee5d6ba785e92077
1 #ifndef STORAGE_H
2 #define STORAGE_H
4 #include "allocate.h"
5 #include "lib.h"
7 /*
8 * The "storage" that underlies an incoming/outgoing pseudo. It's
9 * basically the backing store for a pseudo, and may be a real hardware
10 * register, a stack slot or a static symbol. Or nothing at all,
11 * since some pseudos can just be recalculated on the fly.
13 enum storage_type {
14 REG_UDEF,
15 REG_REG,
16 REG_STACK,
17 REG_FRAME,
18 REG_SYM,
19 REG_ARG,
20 REG_BAD,
23 enum inout_enum {
24 STOR_IN,
25 STOR_OUT
28 struct storage;
29 DECLARE_PTR_LIST(storage_ptr_list, struct storage *);
31 struct storage {
32 enum storage_type type;
33 int name;
34 struct storage_ptr_list *users;
35 union {
36 int regno;
37 int offset;
38 struct symbol *sym;
42 DECLARE_PTR_LIST(storage_list, struct storage);
44 struct storage_hash {
45 struct basic_block *bb;
46 pseudo_t pseudo;
47 enum inout_enum inout;
48 struct storage *storage;
49 unsigned long flags;
52 DECLARE_PTR_LIST(storage_hash_list, struct storage_hash);
54 extern struct storage_hash_list *gather_storage(struct basic_block *, enum inout_enum);
55 extern void free_storage(void);
56 extern const char *show_storage(struct storage *);
57 extern void set_up_storage(struct entrypoint *);
58 struct storage *lookup_storage(struct basic_block *, pseudo_t, enum inout_enum);
59 void add_storage(struct storage *, struct basic_block *, pseudo_t, enum inout_enum);
61 DECLARE_ALLOCATOR(storage);
62 DECLARE_ALLOCATOR(storage_hash);
64 static inline struct storage *alloc_storage(void)
66 return __alloc_storage(0);
69 static inline struct storage_hash *alloc_storage_hash(struct storage *s)
71 struct storage_hash *entry = __alloc_storage_hash(0);
72 struct storage **usep = &entry->storage;
74 *usep = s;
75 add_ptr_list(&s->users, usep);
76 return entry;
79 #endif /* STORAGE_H */