| class AM_CURSOR < $IS_EQ |
|---|
| $IS_EQ |
| attr assign_in_order:BOOL; |
|---|
| **** | returns the expressions of assignments before the assign stmt. Most of the time this is not desired, but sometimes (like CSE) we need it |
| attr cur:$AM; |
|---|
| attr ignore_assert:BOOL; |
|---|
| **** | before the assign stmt. Most of the time this is not desired, but sometimes (like CSE) we need it |
| attr ignore_next:BOOL; |
|---|
| attr ignore_post:BOOL; |
|---|
| attr ignore_pre:BOOL; |
|---|
| attr indent:INT; |
|---|
| attr loops:INT; |
|---|
| attr mark:BOOL; |
|---|
| attr prog:PROG; |
|---|
| attr stack:A_STACK{AM_CURSOR_POS}; |
|---|
| attr started:BOOL; |
|---|
| **** | can be deleted after fullt debugging this class |
| attr top:$AM; |
|---|
| attr with_side_effects:BOOL; |
|---|
| attr assign_in_order:BOOL; |
|---|
| **** | returns the expressions of assignments before the assign stmt. Most of the time this is not desired, but sometimes (like CSE) we need it |
| attr cur:$AM; |
|---|
| attr ignore_assert:BOOL; |
|---|
| **** | before the assign stmt. Most of the time this is not desired, but sometimes (like CSE) we need it |
| attr ignore_next:BOOL; |
|---|
| attr ignore_post:BOOL; |
|---|
| attr ignore_pre:BOOL; |
|---|
| attr indent:INT; |
|---|
| attr loops:INT; |
|---|
| attr mark:BOOL; |
|---|
| attr prog:PROG; |
|---|
| attr stack:A_STACK{AM_CURSOR_POS}; |
|---|
| attr started:BOOL; |
|---|
| **** | can be deleted after fullt debugging this class |
| attr top:$AM; |
|---|
| attr with_side_effects:BOOL; |
|---|
| adjust_marks_on_stack(c:SAME) |
|---|
| **** | we need two loops as we do not know if some new nodes have been inserted or deleted. |
| after_if |
|---|
| **** | sets the current position to the last statement of the test/if_true/if_false of the if stmt, such that the next next! will return the first statement after the if; We use the same trick as below in after_loop |
| after_loop |
|---|
| **** | sets the current position to the last statement of the body list of a loop, or, if empty, to the last list of the init part (if it is not empty). The next! will return the first statement after the loop. |
| append_to_loop(am:$AM_STMT) |
|---|
| back_to_mark |
|---|
| **** | #OUT+"before executing back_to_mark. Current position: \n"+str; |
| begin_of_loop_body |
|---|
| **** | sets the current position to the last statement of the init list of a loop, or, if init is empty, to the loop statement. The next next! will then return the first statement of the loop body. |
| create(c:SAME):SAME |
|---|
| create(prog:PROG,am:$AM):SAME |
|---|
| delete_current |
|---|
| find_node(am:$AM):BOOL |
|---|
| **** |
| get_surr_stmt:$AM_STMT |
|---|
| in_iter_init:BOOL |
|---|
| in_loop:BOOL |
|---|
| init_next |
|---|
| innermost_loop |
|---|
| insert_after_mark(am:$AM_STMT,weight:INT):BOOL |
|---|
| insert_after_mark(am:$AM_STMT,weight:INT,after_prefetch:BOOL):BOOL |
|---|
| **** | if cur is AM_LOCAL_EXPR, we could not find it again in find_node at the end of the function (the same is actually true for constants, but we don't check them here) |
| insert_after_mark_after_prefetch(am:$AM_STMT,weight:INT):BOOL |
|---|
| insert_in_loop_init(am:$AM_STMT) |
|---|
| **** | if prog.opt_debug then #OUT+"CURSOR: insert stmt in loop init, before inserting:\n"+str;end; |
| insert_stmt_after(am:$AM_STMT) |
|---|
| insert_stmt_before(am:$AM_STMT) |
|---|
| insert_stmt_before_loop(am:$AM_STMT) |
|---|
| **** | if prog.opt_debug then #OUT+"CURSOR: insert stmt before loop, before inserting:\n"+str;end; |
| insert_stmt_before_stmt(am:$AM_STMT) |
|---|
| **** | if prog.opt_debug then
____#OUT+"CURSOR:_insert_stmt_before_stmt,_before_inserting:\n"+str; ____#OUT+"Statement_to_insert:\n"; ____AM_OUT::AM_out(am); ____#OUT+"inserting_it_in\n"; ____AM_OUT::AM_out(top); end; |
| is_const(am:$AM):BOOL |
|---|
| is_const_in_func(am:$AM):BOOL |
|---|
| is_const_in_func_before_eval_cur_expr(am:$AM):BOOL |
|---|
| is_const_in_loop(am:$AM):BOOL |
|---|
| is_const_in_loop_before_eval_cur_expr(am:$AM):BOOL |
|---|
| is_current_lhs:BOOL |
|---|
| is_eq(c:SAME):BOOL |
|---|
| **** |
___#OUT+"comparing_two_AM_CURSOR:\n"; ___#OUT+"top:\t"+SYS::id(top)+"\t"+SYS::id(c.top)+"\n"; ___#OUT+"cur:\t"+SYS::id(cur)+"\t"+SYS::id(c.cur)+"\n"; ___#OUT+"loops:\t"+loops+"\t"+c.loops+"\n"; ___#OUT+"indent:\t"+indent+"\t"+c.indent+"\n"; ___#OUT+"size:\t"+stack.size+"\t"+c.stack.size+"\n"; ___#OUT+str+c.str; |
| is_exec_after_and_const_from_there(after:AM_CURSOR,am:$AM):BOOL |
|---|
| **** | first we check if we are in a part of the code that is only executed if some conditions are true |
| is_lhs_of_at_expr:BOOL |
|---|
| is_neq(t:SAME):BOOL |
|---|
| is_non_fatal_and_const_in_func(am:$AM):BOOL |
|---|
| is_non_fatal_and_const_in_func_before_eval_cur_expr(am:$AM):BOOL |
|---|
| is_non_fatal_and_const_in_loop(am:$AM):BOOL |
|---|
| is_non_fatal_and_const_in_loop_before_eval_cur_expr(am:$AM):BOOL |
|---|
| is_not_used_in_func(am:$AM):BOOL |
|---|
| is_not_used_in_func_before_eval_cur_expr(am:$AM):BOOL |
|---|
| is_not_used_in_loop_before_eval_cur_expr(am:$AM):BOOL |
|---|
| is_not_used_outside_innermost_loop(am:$AM):BOOL |
|---|
| lock_stmt:AM_LOCK_STMT |
|---|
| loop_or_lock_stmt:$AM_STMT |
|---|
| loop_stmt:AM_LOOP_STMT |
|---|
| mark_stack |
|---|
| next |
|---|
| **** | or after calling init_next |
| next:$AM |
|---|
| **** | may only be called during a loop that uses next!, or after calling init_next |
| next_stmt |
|---|
| **** | the cursor is moved to next Node after cur. |
| next_stmt:$AM |
|---|
| **** | moves the cursor to the next stmt (cur.next). if cur.next is void the cursor is moved to next Node after cur. |
| not_in_a_case_in_a_loop:BOOL |
|---|
| not_in_a_conditional_in_loop:BOOL |
|---|
| not_prefetch_attr:BOOL |
|---|
| prefetch_stmt:AM_PREFETCH_STMT |
|---|
| print_cur |
|---|
| replace(am:$AM) |
|---|
| replace_expr(w:$AM_EXPR) |
|---|
| **** | if prog.opt_debug then #OUT+"CURSOR: replace_expr, before replacing:\n"+str;end; |
| replace_stmt(am:$AM_STMT) |
|---|
| **** | if prog.opt_debug then #OUT+"CURSOR: replace_stmt, before replacing:\n"+str;end; |
| str:STR |
|---|
| surr_stmt |
|---|
| test_am_cursor |
|---|
| waitfor_stmt:AM_WAITFOR_STMT |
|---|
| weight_after(cc:AM_CURSOR):INT |
|---|
| next! |
|---|
| next!:$AM |
|---|