PIPS
|
Go to the source code of this file.
Macros | |
#define | STACK_NULL ((stack) NULL) |
defines for empty values More... | |
#define | STACK_NULL_P(s) ((s)==STACK_NULL) |
#define | stack_undefined ((stack)-14) |
#define | stack_undefined_p(s) ((s)==stack_undefined) |
#define | STACK_CHECK(s) |
#define | STACK_MAP_X(_item, _itemtype, _code, _stack, _downwards) |
not needed More... | |
#define | STACK_MAP(_item, _itemtype, _code, _stack) STACK_MAP_X(_item, _itemtype, _code, _stack, true) |
Typedefs | |
typedef struct __stack_head * | stack |
STACK MANAGEMENT – headers. More... | |
typedef struct __stack_iterator * | stack_iterator |
Functions | |
stack | stack_make (int, int, int) |
allocation More... | |
void | stack_free (stack *) |
type, bucket_size, policy More... | |
stack | stack_copy (const stack) |
duplicate a stack with its contents. More... | |
int | stack_size (const stack) |
observers More... | |
int | stack_type (const stack) |
int | stack_bsize (const stack) |
int | stack_policy (const stack) |
int | stack_max_extent (const stack) |
int | stack_consistent_p (const stack) |
miscellaneous More... | |
bool | stack_empty_p (const stack) |
void | stack_info (FILE *, const stack) |
void | stack_map (const stack, gen_iter_func_t) |
APPLY f to all items of stack s;. More... | |
void | stack_push (void *, stack) |
stack use More... | |
void * | stack_pop (stack) |
POPs one item from stack s. More... | |
void * | stack_head (const stack) |
returns the item on top of stack s More... | |
void * | stack_nth (const stack, int) |
returns the nth item starting from the head and counting from 1, when possible, or NULL, elsewhere. More... | |
void * | stack_replace (void *, stack) |
REPLACEs the item on top of stack s, and returns the old item. More... | |
stack_iterator | stack_iterator_init (const stack, bool) |
stack iterator More... | |
bool | stack_iterator_next_and_go (stack_iterator, void **) |
X-ward. More... | |
void | stack_iterator_end (stack_iterator *) |
bool | stack_iterator_end_p (stack_iterator) |
#define STACK_CHECK | ( | s | ) |
Definition at line 58 of file newgen_stack.h.
#define STACK_MAP | ( | _item, | |
_itemtype, | |||
_code, | |||
_stack | |||
) | STACK_MAP_X(_item, _itemtype, _code, _stack, true) |
Definition at line 116 of file newgen_stack.h.
#define STACK_MAP_X | ( | _item, | |
_itemtype, | |||
_code, | |||
_stack, | |||
_downwards | |||
) |
not needed
applies _code on the items of _stack downward , with _item of _itemtype.
Definition at line 104 of file newgen_stack.h.
#define STACK_NULL ((stack) NULL) |
defines for empty values
Definition at line 52 of file newgen_stack.h.
#define STACK_NULL_P | ( | s | ) | ((s)==STACK_NULL) |
Definition at line 53 of file newgen_stack.h.
#define stack_undefined ((stack)-14) |
Definition at line 55 of file newgen_stack.h.
#define stack_undefined_p | ( | s | ) | ((s)==stack_undefined) |
Definition at line 56 of file newgen_stack.h.
typedef struct __stack_head* stack |
STACK MANAGEMENT – headers.
newgen_assert should be included before.
Fabien COELHO 05/12/1994 encapsulated types
Definition at line 47 of file newgen_stack.h.
typedef struct __stack_iterator* stack_iterator |
Definition at line 48 of file newgen_stack.h.
int stack_bsize | ( | const | stack | ) |
int stack_consistent_p | ( | const | stack | ) |
miscellaneous
stack stack_copy | ( | const | stack | ) |
duplicate a stack with its contents.
Definition at line 267 of file stack.c.
References __stack_head::bucket_size, __stack_head::policy, stack_make(), STACK_MAP_X, stack_push(), and __stack_head::type.
Referenced by RenameFunctionEntity(), store_call_context(), and SubstituteDummyParameters().
bool stack_empty_p | ( | const | stack | ) |
Referenced by actual_c_parser(), c_parser_scope_stack_empty_p(), EnterScope(), eov_stack_task_pop_task(), ExitScope(), FindOrCreateCurrentEntity(), get_current_statement_from_statement_global_stack(), GetContext(), GetParentScope(), GetScope(), PopContext(), preprocessor_scope_stack_empty_p(), reset_c_parser_scope_stack(), reset_preprocessor_scope_stack(), ResetTypedefStack(), string_buffer_reset(), and UpdateEntity().
void stack_free | ( | stack * | ps | ) |
type, bucket_size, policy
Definition at line 292 of file stack.c.
References free_buckets(), gen_free_area(), stack_head(), STACK_NULL, and STACK_PTR_NULL.
Referenced by actual_c_parser(), bottom_up_abc_statement(), c_parser_error(), force_reset_c_parser_scope_stack(), force_reset_preprocessor_scope_stack(), ForceResetTypedefStack(), free_statement_global_stack(), gen_internal_context_multi_recurse(), initial_code_abc_statement(), interprocedural_abc_statement(), loop_statistics(), pips_code_abc_statement(), remove_entity_type_stack(), reset_c_parser_scope_stack(), reset_entity_type_stack_table(), reset_preprocessor_scope_stack(), reset_statement_points_to_context(), ResetCurrentModule(), ResetTypedefStack(), string_buffer_free(), top_down_abc_statement(), typing_of_expressions(), xml_Boxes(), xml_Task(), and xml_tasks().
void* stack_head | ( | const | stack | ) |
returns the item on top of stack s
HEAD
Definition at line 420 of file stack.c.
References assert, __stack_head::stack, STACK_PTR_NULL_P, and x.
Referenced by abc_instrumentation_insert_before_statement(), add_arc_to_statement_points_to_context(), arguments_are_something(), bottom_up_abc_insert_before_statement(), call_rwt(), check_format(), check_io_list(), check_spec(), check_this_loop(), check_this_test(), check_this_whileloop(), EnterScope(), eov_stack_task_pop_task(), ExitScope(), FindOrCreateCurrentEntity(), gen_get_recurse_current_ancestor(), get_c_parser_current_scope(), get_current_statement_from_statement_global_stack(), get_preprocessor_current_scope(), GetContext(), GetContextCopy(), GetFunction(), GetScope(), interprocedural_abc_insert_before_statement(), is_integer_specifier(), is_label_integer_string_specifier(), is_label_specifier(), is_string_specifier(), is_unit_specifier(), is_varibale_array_element_specifier(), loop_flt(), loop_rwt(), MakeBreakStatement(), MakeCaseStatement(), MakeContinueStatement(), MakeDefaultStatement(), MakeForloop(), MakeParameterList(), MakeSwitchStatement(), MakeWhileLoop(), points_to_context_statement_in(), PopContext(), push_if(), push_loop(), pv_context_statement_head(), quick_multi_already_seen_p(), seq_rwt(), stack_free(), StackPop(), StackPush(), statement_with_at_most_one_expression_integer(), statement_with_at_most_one_integer_or_character(), statement_without_argument(), stmt_rwt(), store_call_context(), test_rwt(), top_down_abc_insert_before_statement(), type_this_entity_if_needed(), type_this_expression(), type_this_instruction(), typing_arguments_of_user_function(), typing_assign_substring(), typing_buffer_inout(), typing_function_argument_type_to_return_type(), typing_implied_do(), typing_of_assign(), typing_substring(), uns_rwt(), update_statement_points_to_context_with_arc(), UpdateAbstractEntity(), UpdateDerivedEntity(), UpdateEntity(), and wl_rwt().
void stack_info | ( | FILE * | f, |
const | stack | ||
) |
else
else
Definition at line 342 of file stack.c.
References __stack_head::avail, f(), fprintf(), __stack_head::max_extent, number_of_buckets(), __stack_head::size, __stack_head::stack, STACK_NULL_P, stack_undefined_p, and __stack_head::type.
void stack_iterator_end | ( | stack_iterator * | pi | ) |
Definition at line 184 of file stack.c.
References free(), and NEWGEN_FREED.
bool stack_iterator_end_p | ( | stack_iterator | i | ) |
stack_iterator stack_iterator_init | ( | const | stack, |
bool | down | ||
) |
stack iterator
This way the stack type is fully encapsulated, but it is not very efficient, due to the many function calls. Consider "stack_map" first which has a very small overhead.
Definition at line 157 of file stack.c.
References malloc(), and stack_iterator_internal_init().
bool stack_iterator_next_and_go | ( | stack_iterator | i, |
void ** | pitem | ||
) |
X-ward.
Definition at line 164 of file stack.c.
References __stack_iterator::bucket, __stack_iterator::index, __stack_bucket::items, NEXT_ITERATION, and STACK_ITERATOR_END_P.
Referenced by stack_nth().
allocation
allocation
type | record newgen domain of stack contents. should be used to check the type of appended elements. |
bucket_size | is the number of elements in the elemental stack container. If you now you will have big stacks, try big numbers here to save memory. |
policy | not used, 0 is fine. |
not too small
not used
Definition at line 246 of file stack.c.
References allocate_bucket(), __stack_head::avail, __stack_head::bucket_size, malloc(), __stack_head::max_extent, message_assert, __stack_head::n_buckets, __stack_head::policy, __stack_head::size, __stack_head::stack, STACK_DEFAULT_SIZE, STACK_PTR_NULL, and __stack_head::type.
Referenced by actual_c_parser(), bottom_up_abc_statement(), eov_make_ctx(), gen_internal_context_multi_recurse(), guard_elimination(), init_c_parser_scope_stack(), init_preprocessor_scope_stack(), init_statement_points_to_context(), initial_code_abc_statement(), InitializeBlock(), interprocedural_abc_statement(), loop_statistics(), make_simple_pv_context(), make_statement_global_stack(), MakeCurrentModule(), MakeTypedefStack(), pips_code_abc_statement(), push_pips_context(), stack_copy(), string_buffer_make(), tiling_sequence(), top_down_abc_statement(), typing_of_expressions(), xml_Boxes(), xml_Task(), and xml_tasks().
void stack_map | ( | const | stack, |
gen_iter_func_t | f | ||
) |
APPLY f to all items of stack s;.
Definition at line 323 of file stack.c.
References __stack_head::stack, STACK_CHECK, and x.
int stack_max_extent | ( | const | stack | ) |
returns the nth item starting from the head and counting from 1, when possible, or NULL, elsewhere.
stack_nth(stack,1)==stack_head(stack) if stack_size(stack)>=1.
Definition at line 436 of file stack.c.
References message_assert, stack_iterator_internal_init(), and stack_iterator_next_and_go().
Referenced by get_c_parser_nth_scope(), get_preprocessor_nth_scope(), and GetParentScope().
int stack_policy | ( | const | stack | ) |
void* stack_pop | ( | stack | s | ) |
POPs one item from stack s.
the empty buckets are not freed here. stack_free does the job.
POP!
Definition at line 399 of file stack.c.
References assert, __stack_head::avail, __stack_head::size, __stack_head::stack, STACK_PTR_NULL_P, and x.
Referenced by eov_stack_task_pop_task(), ExitScope(), gen_internal_context_multi_recurse(), MakeForloop(), NStackPop(), pop_c_parser_scope_stack(), pop_current_statement(), pop_if(), pop_loop(), pop_pips_context(), pop_preprocessor_scope(), pop_statement_global_stack(), pop_statement_points_to_context(), pop_uns(), PopContext(), PopFunction(), PopTypedef(), pv_context_statement_pop(), quick_multi_recurse_obj_out(), stmt_rwt(), string_buffer_reset(), UpdateAbstractEntity(), UpdateDerivedEntity(), and UpdateEntity().
void stack_push | ( | void * | item, |
stack | s | ||
) |
stack use
stack use
PUSHes the item on stack s
a new bucket is allocated if necessary. the size it the same than the initial bucket size. Other policies may be considered.
PUSH!
Definition at line 373 of file stack.c.
References assert, find_or_allocate(), __stack_head::max_extent, __stack_head::size, __stack_head::stack, STACK_PTR_NULL_P, and x.
Referenced by EnterScope(), eov_stack_task_push_task(), gen_internal_context_multi_recurse(), push_current_statement(), push_if(), push_loop(), push_new_c_parser_scope(), push_new_preprocessor_scope(), push_pips_context(), push_statement_on_statement_global_stack(), push_statement_points_to_context(), push_uns(), PushContext(), PushFunction(), PushTypedef(), pv_context_statement_push(), quick_multi_recurse_obj_in(), stack_copy(), StackPush(), stmt_flt(), and string_buffer_append_internal().
void* stack_replace | ( | void * | item, |
stack | s | ||
) |
REPLACEs the item on top of stack s, and returns the old item.
REPLACE
Definition at line 450 of file stack.c.
References assert, __stack_head::stack, STACK_PTR_NULL_P, and x.
int stack_size | ( | const | stack | ) |
observers
Referenced by abc_instrumentation_insert_before_statement(), bottom_up_abc_insert_before_statement(), c_parser_number_of_scopes(), eov_free_ctx(), gen_internal_context_multi_recurse(), GetContext(), GetContextCopy(), GetParentScope(), interprocedural_abc_insert_before_statement(), PopContext(), preprocessor_scope_number(), PushContext(), ScopeStackSize(), top_down_abc_insert_before_statement(), UpdateAbstractEntity(), UpdateDerivedEntity(), UpdateEntity(), and xml_tiling().
int stack_type | ( | const | stack | ) |