8 * Basic helper routine descriptions for 'sparse'.
10 * Copyright (C) 2003 Transmeta Corp.
14 * Licensed under the Open Software License version 1.1
20 extern int verbose
, optimize
, optimize_size
, preprocessing
;
21 extern int repeat_phase
, merge_phi_sources
;
22 extern int gcc_major
, gcc_minor
;
24 extern unsigned int hexval(unsigned int c
);
47 DECLARE_PTR_LIST(symbol_list
, struct symbol
);
48 DECLARE_PTR_LIST(statement_list
, struct statement
);
49 DECLARE_PTR_LIST(expression_list
, struct expression
);
50 DECLARE_PTR_LIST(basic_block_list
, struct basic_block
);
51 DECLARE_PTR_LIST(instruction_list
, struct instruction
);
52 DECLARE_PTR_LIST(multijmp_list
, struct multijmp
);
53 DECLARE_PTR_LIST(pseudo_list
, struct pseudo
);
55 typedef struct pseudo
*pseudo_t
;
57 struct token
*skip_to(struct token
*, int);
58 struct token
*expect(struct token
*, int, const char *);
60 #define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1)))
62 #define FORMAT_ATTR(pos)
64 extern void die(const char *, ...) FORMAT_ATTR(1);
65 extern void info(struct position
, const char *, ...) FORMAT_ATTR(2);
66 extern void warning(struct position
, const char *, ...) FORMAT_ATTR(2);
67 extern void sparse_error(struct position
, const char *, ...) FORMAT_ATTR(2);
68 extern void error_die(struct position
, const char *, ...) FORMAT_ATTR(2);
71 extern char **handle_switch(char *arg
, char **next
);
72 extern void add_pre_buffer(const char *fmt
, ...);
74 extern int preprocess_only
;
75 extern int Wptr_subtraction_blows
;
76 extern int Wdefault_bitfield_sign
;
77 extern int Wundefined_preprocessor
;
78 extern int Wbitwise
, Wtypesign
, Wcontext
;
79 extern int Wtransparent_union
;
80 extern int Wcast_to_address_space
;
82 extern int Wone_bit_signed_bitfield
;
84 extern void declare_builtin_functions(void);
85 extern void create_builtin_stream(void);
86 extern struct symbol_list
*sparse_initialize(int argc
, char **argv
);
87 extern struct symbol_list
*__sparse(char **argv
);
88 extern struct symbol_list
*sparse(char **argv
);
90 static inline int symbol_list_size(struct symbol_list
* list
)
92 return ptr_list_size((struct ptr_list
*)(list
));
95 static inline int statement_list_size(struct statement_list
* list
)
97 return ptr_list_size((struct ptr_list
*)(list
));
100 static inline int expression_list_size(struct expression_list
* list
)
102 return ptr_list_size((struct ptr_list
*)(list
));
105 static inline int instruction_list_size(struct instruction_list
* list
)
107 return ptr_list_size((struct ptr_list
*)(list
));
110 static inline int pseudo_list_size(struct pseudo_list
* list
)
112 return ptr_list_size((struct ptr_list
*)(list
));
115 static inline int bb_list_size(struct basic_block_list
* list
)
117 return ptr_list_size((struct ptr_list
*)(list
));
120 static inline void free_instruction_list(struct instruction_list
**head
)
122 free_ptr_list((struct ptr_list
**)head
);
125 static inline struct instruction
* delete_last_instruction(struct instruction_list
**head
)
127 return undo_ptr_list_last((struct ptr_list
**)head
);
130 static inline struct basic_block
* delete_last_basic_block(struct basic_block_list
**head
)
132 return delete_ptr_list_last((struct ptr_list
**)head
);
135 static inline struct basic_block
*first_basic_block(struct basic_block_list
*head
)
137 return first_ptr_list((struct ptr_list
*)head
);
139 static inline struct instruction
*last_instruction(struct instruction_list
*head
)
141 return last_ptr_list((struct ptr_list
*)head
);
144 static inline struct instruction
*first_instruction(struct instruction_list
*head
)
146 return first_ptr_list((struct ptr_list
*)head
);
149 static inline pseudo_t
first_pseudo(struct pseudo_list
*head
)
151 return first_ptr_list((struct ptr_list
*)head
);
154 static inline void concat_symbol_list(struct symbol_list
*from
, struct symbol_list
**to
)
156 concat_ptr_list((struct ptr_list
*)from
, (struct ptr_list
**)to
);
159 static inline void concat_basic_block_list(struct basic_block_list
*from
, struct basic_block_list
**to
)
161 concat_ptr_list((struct ptr_list
*)from
, (struct ptr_list
**)to
);
164 static inline void concat_instruction_list(struct instruction_list
*from
, struct instruction_list
**to
)
166 concat_ptr_list((struct ptr_list
*)from
, (struct ptr_list
**)to
);
169 static inline void add_symbol(struct symbol_list
**list
, struct symbol
*sym
)
171 add_ptr_list(list
, sym
);
174 static inline void add_statement(struct statement_list
**list
, struct statement
*stmt
)
176 add_ptr_list(list
, stmt
);
179 static inline void add_expression(struct expression_list
**list
, struct expression
*expr
)
181 add_ptr_list(list
, expr
);
184 #define hashval(x) ((unsigned long)(x))