Remove some false positives and enable the check.
[smatch.git] / storage.h
blob610cbfd247020a6e78166783c6db6c1a92e15b64
1 #ifndef STORAGE_H
2 #define STORAGE_H
4 /*
5 * The "storage" that underlies an incoming/outgoing pseudo. It's
6 * basically the backing store for a pseudo, and may be a real hardware
7 * register, a stack slot or a static symbol. Or nothing at all,
8 * since some pseudos can just be recalculated on the fly.
9 */
10 enum storage_type {
11 REG_UDEF,
12 REG_REG,
13 REG_STACK,
14 REG_FRAME,
15 REG_SYM,
16 REG_ARG,
17 REG_BAD,
20 enum inout_enum {
21 STOR_IN,
22 STOR_OUT
25 struct storage;
26 DECLARE_PTR_LIST(storage_ptr_list, struct storage *);
28 struct storage {
29 enum storage_type type;
30 int name;
31 struct storage_ptr_list *users;
32 union {
33 int regno;
34 int offset;
35 struct symbol *sym;
39 DECLARE_PTR_LIST(storage_list, struct storage);
41 struct storage_hash {
42 struct basic_block *bb;
43 pseudo_t pseudo;
44 enum inout_enum inout;
45 struct storage *storage;
46 unsigned long flags;
49 DECLARE_PTR_LIST(storage_hash_list, struct storage_hash);
51 extern struct storage_hash_list *gather_storage(struct basic_block *, enum inout_enum);
52 extern void free_storage(void);
53 extern const char *show_storage(struct storage *);
54 extern void set_up_storage(struct entrypoint *);
55 struct storage *lookup_storage(struct basic_block *, pseudo_t, enum inout_enum);
56 void add_storage(struct storage *, struct basic_block *, pseudo_t, enum inout_enum);
58 DECLARE_ALLOCATOR(storage);
59 DECLARE_ALLOCATOR(storage_hash);
61 static inline struct storage *alloc_storage(void)
63 return __alloc_storage(0);
66 static inline struct storage_hash *alloc_storage_hash(struct storage *s)
68 struct storage_hash *entry = __alloc_storage_hash(0);
69 struct storage **usep = &entry->storage;
71 *usep = s;
72 add_ptr_list(&s->users, usep);
73 return entry;
76 #endif /* STORAGE_H */