diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-06 11:00:15 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:07 -0700 |
commit | dd9cfb98ae580a52173462d4cbf97ec2f28eeec9 (patch) | |
tree | f1cca957073b06770aebe2286ae25a40d0b7659f | |
parent | Re-organize list access macros for easier expansion. (diff) | |
download | sparse-dd9cfb98ae580a52173462d4cbf97ec2f28eeec9.tar.gz sparse-dd9cfb98ae580a52173462d4cbf97ec2f28eeec9.tar.bz2 sparse-dd9cfb98ae580a52173462d4cbf97ec2f28eeec9.zip |
Make END_FOR_EACH_PTR[_REVERSE] take the ptr name as an argument.
..and switch us entirely over to the new naming scheme.
All the nasty work of going through the users thanks to Chris Li.
-rw-r--r-- | compile-i386.c | 30 | ||||
-rw-r--r-- | evaluate.c | 12 | ||||
-rw-r--r-- | expand.c | 8 | ||||
-rw-r--r-- | inline.c | 18 | ||||
-rw-r--r-- | lib.c | 2 | ||||
-rw-r--r-- | lib.h | 14 | ||||
-rw-r--r-- | linearize.c | 28 | ||||
-rw-r--r-- | parse.c | 10 | ||||
-rw-r--r-- | scope.c | 2 | ||||
-rw-r--r-- | show-parse.c | 12 | ||||
-rw-r--r-- | symbol.c | 2 |
11 files changed, 69 insertions, 69 deletions
diff --git a/compile-i386.c b/compile-i386.c index 6a52771..0ef5245 100644 --- a/compile-i386.c +++ b/compile-i386.c @@ -731,7 +731,7 @@ static void emit_atom_list(struct function *f) assert(0); break; } - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(atom); } static void emit_string_list(struct function *f) @@ -746,7 +746,7 @@ static void emit_string_list(struct function *f) printf("\t.string\t%s\n", show_string(atom->string)); free(atom); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(atom); } static void func_cleanup(struct function *f) @@ -756,7 +756,7 @@ static void func_cleanup(struct function *f) FOR_EACH_PTR(f->pseudo_list, stor) { free(stor); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(stor); FOR_EACH_PTR(f->atom_list, atom) { if ((atom->type == ATOM_TEXT) && (atom->text)) @@ -766,7 +766,7 @@ static void func_cleanup(struct function *f) if (atom->op2 && (atom->op2->flags & STOR_WANTS_FREE)) free(atom->op2); free(atom); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(atom); free_ptr_list(&f->pseudo_list); free(f); @@ -785,7 +785,7 @@ static void emit_func_pre(struct symbol *sym) FOR_EACH_PTR(base_type->arguments, arg) { argc++; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); alloc_len = sizeof(*f) + @@ -815,7 +815,7 @@ static void emit_func_pre(struct symbol *sym) storage_base[i].idx = i; privbase[i].addr = &storage_base[i]; i++; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); assert(current_func == NULL); current_func = f; @@ -977,7 +977,7 @@ static void sort_array(struct expression *expr) elem = 0; FOR_EACH_PTR(expr->expr_list, entry) { elem++; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); if (!elem) return; @@ -1019,13 +1019,13 @@ static void sort_array(struct expression *expr) sorted++; } } - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); i = 0; FOR_EACH_PTR(expr->expr_list, entry) { if ((entry->type == EXPR_POS) || (entry->type == EXPR_VALUE)) *THIS_ADDRESS(entry) = list[i++]; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); } @@ -1058,7 +1058,7 @@ static void emit_array(struct symbol *sym) emit_initializer(sym, entry->init_expr); ea_last = ea_current; } - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); } void emit_one_symbol(struct symbol *sym) @@ -1760,7 +1760,7 @@ static void emit_switch_statement(struct statement *stmt) emit_label(next_test, NULL); } } - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); if (default_sym) { labelsym = new_labelsym(default_sym); @@ -1865,7 +1865,7 @@ static void x86_symbol_decl(struct symbol_list *syms) struct symbol *sym; FOR_EACH_PTR(syms, sym) { x86_symbol_init(sym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); } static void loopstk_push(int cont_lbl, int loop_bottom_lbl) @@ -1995,7 +1995,7 @@ static struct storage *x86_statement(struct statement *stmt) x86_symbol_decl(stmt->syms); FOR_EACH_PTR(stmt->stmts, s) { last = x86_statement(s); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(s); return last; } @@ -2083,7 +2083,7 @@ static struct storage *x86_call_expression(struct expression *expr) !framesize ? "begin function call" : NULL); framesize += size >> 3; - } END_FOR_EACH_PTR_REVERSE; + } END_FOR_EACH_PTR_REVERSE(arg); fn = expr->fn; @@ -2313,7 +2313,7 @@ static void x86_initializer_expr(struct expression *expr, struct symbol *ctype) continue; } x86_initialization(ctype, entry); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); } /* @@ -1124,7 +1124,7 @@ static void examine_fn_arguments(struct symbol *fn) break; } } - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(s); } static struct symbol *convert_to_as_mod(struct symbol *sym, int as, int mod) @@ -1709,7 +1709,7 @@ static int evaluate_arguments(struct symbol *f, struct symbol *fn, struct expres i++; NEXT_PTR_LIST(argtype); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(expr); FINISH_PTR_LIST(argtype); return 1; } @@ -1741,7 +1741,7 @@ static int evaluate_array_initializer(struct symbol *ctype, struct expression *e current += entries; if (current > max) max = current; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); return max; } @@ -1790,7 +1790,7 @@ static int evaluate_struct_or_union_initializer(struct symbol *ctype, struct exp evaluate_initializer(sym, p, offset + sym->offset); NEXT_PTR_LIST(sym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); FINISH_PTR_LIST(sym); return 0; @@ -2306,7 +2306,7 @@ struct symbol *evaluate_statement(struct statement *stmt) /* Evaluate each symbol in the compound statement */ FOR_EACH_PTR(stmt->syms, sym) { evaluate_symbol(sym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); evaluate_symbol(stmt->ret); /* @@ -2316,7 +2316,7 @@ struct symbol *evaluate_statement(struct statement *stmt) type = NULL; FOR_EACH_PTR(stmt->stmts, s) { type = evaluate_statement(s); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(s); if (!type) type = &void_ctype; return type; @@ -634,7 +634,7 @@ static int expand_arguments(struct expression_list *head) FOR_EACH_PTR (head, expr) { cost += expand_expression(expr); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(expr); return cost; } @@ -692,7 +692,7 @@ static int expand_expression_list(struct expression_list *list) FOR_EACH_PTR(list, expr) { cost += expand_expression(expr); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(expr); return cost; } @@ -861,13 +861,13 @@ static int expand_statement(struct statement *stmt) FOR_EACH_PTR(stmt->syms, sym) { expand_symbol(sym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); expand_symbol(stmt->ret); cost = 0; FOR_EACH_PTR(stmt->stmts, s) { cost += expand_statement(s); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(s); return cost; } @@ -51,7 +51,7 @@ static struct symbol_list *copy_symbol_list(struct symbol_list *src) FOR_EACH_PTR(src, sym) { struct symbol *newsym = copy_symbol(sym->pos, sym); add_symbol(&dst, newsym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); return dst; } @@ -179,7 +179,7 @@ static struct expression * copy_expression(struct expression *expr) expr->args = NULL; FOR_EACH_PTR(list, arg) { add_expression(&expr->args, copy_expression(arg)); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); break; } @@ -191,7 +191,7 @@ static struct expression * copy_expression(struct expression *expr) expr->expr_list = NULL; FOR_EACH_PTR(list, entry) { add_expression(&expr->expr_list, copy_expression(entry)); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); break; } @@ -247,7 +247,7 @@ static void unset_replace_list(struct symbol_list *list) struct symbol *sym; FOR_EACH_PTR(list, sym) { unset_replace(sym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); } static struct statement *copy_one_statement(struct statement *stmt) @@ -375,11 +375,11 @@ void copy_statement(struct statement *src, struct statement *dst) struct symbol *newsym = copy_symbol(src->pos, sym); newsym->initializer = copy_expression(sym->initializer); add_symbol(&dst->syms, newsym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); FOR_EACH_PTR(src->stmts, stmt) { add_statement(&dst->stmts, copy_one_statement(stmt)); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(stmt); dst->ret = copy_symbol(src->pos, src->ret); } @@ -404,7 +404,7 @@ static struct symbol_list *create_symbol_list(struct symbol_list *src) FOR_EACH_PTR(src, sym) { struct symbol *newsym = create_copy_symbol(sym); add_symbol(&dst, newsym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); return dst; } @@ -448,7 +448,7 @@ int inline_function(struct expression *expr, struct symbol *sym) add_symbol(&stmt->syms, a); NEXT_PTR_LIST(name); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); FINISH_PTR_LIST(name); copy_statement(fn->inline_stmt, stmt); @@ -470,7 +470,7 @@ void uninline(struct symbol *sym) sym->symbol_list = create_symbol_list(sym->inline_symbol_list); FOR_EACH_PTR(arg_list, p) { p->replace = p; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(p); fn->stmt = alloc_statement(fn->pos, STMT_COMPOUND); copy_statement(fn->inline_stmt, fn->stmt); unset_replace_list(sym->symbol_list); @@ -458,7 +458,7 @@ void concat_ptr_list(struct ptr_list *a, struct ptr_list **b) void *entry; FOR_EACH_PTR(a, entry) { add_ptr_list(b, entry); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); } void free_ptr_list(struct ptr_list **listp) @@ -379,18 +379,18 @@ static inline void expression_iterate(struct expression_list *list, void (*callb ((__typeof__(&(ptr))) (__list->list + __nr)) #define FOR_EACH_PTR(head, ptr) \ - DO_FOR_EACH(head, ptr, __head, __list, __nr) + DO_FOR_EACH(head, ptr, __head##ptr, __list##ptr, __nr##ptr) -#define END_FOR_EACH_PTR \ - DO_END_FOR_EACH(dummy_unused, __head, __list, __nr) +#define END_FOR_EACH_PTR(ptr) \ + DO_END_FOR_EACH(ptr, __head##ptr, __list##ptr, __nr##ptr) #define FOR_EACH_PTR_REVERSE(head, ptr) \ - DO_FOR_EACH_REVERSE(head, ptr, __head, __list, __nr) + DO_FOR_EACH_REVERSE(head, ptr, __head##ptr, __list##ptr, __nr##ptr) -#define END_FOR_EACH_PTR_REVERSE \ - DO_END_FOR_EACH_REVERSE(dummy_unused, __head, __list, __nr) +#define END_FOR_EACH_PTR_REVERSE(ptr) \ + DO_END_FOR_EACH_REVERSE(ptr, __head##ptr, __list##ptr, __nr##ptr) #define THIS_ADDRESS(ptr) \ - DO_THIS_ADDRESS(ptr, __head, __list, __nr) + DO_THIS_ADDRESS(ptr, __head##ptr, __list##ptr, __nr##ptr) #endif diff --git a/linearize.c b/linearize.c index b9b3ec1..8bc9044 100644 --- a/linearize.c +++ b/linearize.c @@ -127,7 +127,7 @@ static void show_instruction(struct instruction *insn) printf(", %d ... %d -> .L%p", jmp->begin, jmp->end, jmp->target); else printf(", default -> .L%p\n", jmp->target); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(jmp); printf("\n"); break; } @@ -136,7 +136,7 @@ static void show_instruction(struct instruction *insn) printf("\tjmp *%%r%d", insn->target->nr); FOR_EACH_PTR(insn->multijmp_list, jmp) { printf(", .L%p", jmp->target); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(jmp); printf("\n"); break; } @@ -148,7 +148,7 @@ static void show_instruction(struct instruction *insn) FOR_EACH_PTR(insn->phi_list, phi) { printf("%s(%%r%d, .L%p)", s, phi->pseudo->nr, phi->source); s = ", "; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(phi); printf("\n"); break; } @@ -163,7 +163,7 @@ static void show_instruction(struct instruction *insn) printf("\t%%r%d <- CALL %%r%d", insn->target->nr, insn->func->nr); FOR_EACH_PTR(insn->arguments, arg) { printf(", %%r%d", arg->nr); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); printf("\n"); break; } @@ -237,11 +237,11 @@ static void show_bb(struct basic_block *bb) struct basic_block *from; FOR_EACH_PTR(bb->parents, from) { printf(" **from %p**\n", from); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(from); } FOR_EACH_PTR(bb->insns, insn) { show_instruction(insn); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(insn); if (!bb_terminated(bb)) printf("\tEND\n"); printf("\n"); @@ -256,7 +256,7 @@ void show_entry(struct entrypoint *ep) FOR_EACH_PTR(ep->syms, sym) { printf(" sym: %p %s\n", sym, show_ident(sym->ident)); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); printf("\n"); @@ -264,7 +264,7 @@ void show_entry(struct entrypoint *ep) if (bb == ep->entry) printf("ENTRY:\n"); show_bb(bb); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(bb); printf("\n"); } @@ -577,7 +577,7 @@ static pseudo_t linearize_call_expression(struct entrypoint *ep, struct expressi FOR_EACH_PTR(expr->args, arg) { pseudo_t new = linearize_expression(ep, arg); add_pseudo(&insn->arguments, new); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); fn = expr->fn; if (fn->type == EXPR_PREOP) { @@ -917,7 +917,7 @@ pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stmt) struct multijmp *jmp = alloc_multijmp(bb_computed, 1, 0); add_multijmp(&goto_ins->multijmp_list, jmp); add_bb(&bb_computed->parents, ep->active); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); finish_block(ep); break; @@ -932,7 +932,7 @@ pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stmt) ret->bb_target = alloc_basic_block(); FOR_EACH_PTR(stmt->stmts, s) { pseudo = linearize_statement(ep, s); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(s); if (ret) { struct basic_block *bb = ret->bb_target; struct instruction *phi = first_instruction(bb->insns); @@ -1009,7 +1009,7 @@ pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stmt) } add_multijmp(&switch_ins->multijmp_list, jmp); add_bb(&bb_case->parents, ep->active); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); bind_label(stmt->switch_break, switch_end, stmt->pos); @@ -1104,7 +1104,7 @@ void remove_unreachable_bbs(struct entrypoint *ep) bblist = &ep->bbs; FOR_EACH_PTR(*bblist, bb) { bb->flags &= ~BB_REACHABLE; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(bb); mark_bb_reachable(ep->entry); init_iterator((struct ptr_list **) bblist, &iterator, 0); @@ -1154,7 +1154,7 @@ void pack_basic_blocks(struct entrypoint *ep) add_bb(&target->parents, parent); } } - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(parent); /* Move the instructions to the target block. */ delete_last_instruction(&bb->insns); @@ -1356,7 +1356,7 @@ static struct token *parse_function_body(struct token *token, struct symbol *dec *p = stmt; FOR_EACH_PTR (base_type->arguments, arg) { declare_argument(arg, base_type); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); token = compound_statement(token->next, stmt); @@ -1372,7 +1372,7 @@ static struct token *parse_function_body(struct token *token, struct symbol *dec struct statement *stmt; FOR_EACH_PTR(function_computed_goto_list, stmt) { stmt->target_list = function_computed_target_list; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(stmt); } } return expect(token, '}', "at end of function"); @@ -1398,7 +1398,7 @@ static void apply_k_r_types(struct symbol_list *argtypes, struct symbol *fn) FOR_EACH_PTR(argtypes, type) { if (type->ident == arg->ident) goto match; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(type); warn(arg->pos, "missing type declaration for parameter '%s'", show_ident(arg->ident)); continue; match: @@ -1407,12 +1407,12 @@ match: promote_k_r_types(type); arg->ctype = type->ctype; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); FOR_EACH_PTR(argtypes, arg) { if (!arg->used) warn(arg->pos, "nonsensical parameter declaration '%s'", show_ident(arg->ident)); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); } @@ -65,7 +65,7 @@ static void end_scope(struct scope **s) scope->symbols = NULL; FOR_EACH_PTR(symbols, sym) { remove_symbol_scope(sym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); } void end_symbol_scope(void) diff --git a/show-parse.c b/show-parse.c index f277e3d..bd239c5 100644 --- a/show-parse.c +++ b/show-parse.c @@ -52,7 +52,7 @@ static void do_debug_symbol(struct symbol *sym, int indent) do_debug_symbol(arg, 0); fprintf(stderr, " end arg%d >\n", i); i++; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); } do_debug_symbol(sym->ctype.base_type, indent+2); } @@ -392,7 +392,7 @@ static void show_switch_statement(struct statement *stmt) printf(" what?"); } printf(": .L%p\n", sym->bb_target); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); printf("# end case table\n"); show_statement(stmt->switch_statement); @@ -406,7 +406,7 @@ static void show_symbol_decl(struct symbol_list *syms) struct symbol *sym; FOR_EACH_PTR(syms, sym) { show_symbol_init(sym); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(sym); } static int show_return_stmt(struct statement *stmt); @@ -428,7 +428,7 @@ int show_statement(struct statement *stmt) show_symbol_decl(stmt->syms); FOR_EACH_PTR(stmt->stmts, s) { last = show_statement(s); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(s); if (stmt->ret) { int addr, bits; printf(".L%p:\n", stmt->ret); @@ -590,7 +590,7 @@ static int show_call_expression(struct expression *expr) int size = arg->ctype->bit_size; printf("\tpush.%d\t\tv%d\n", size, new); framesize += size >> 3; - } END_FOR_EACH_PTR_REVERSE; + } END_FOR_EACH_PTR_REVERSE(arg); fn = expr->fn; @@ -937,7 +937,7 @@ static int show_initializer_expr(struct expression *expr, struct symbol *ctype) continue; } show_initialization(ctype, entry); - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(entry); return 0; } @@ -370,7 +370,7 @@ static int expand_constant_p(struct expression *expr) FOR_EACH_PTR (arglist, arg) { if (arg->type != EXPR_VALUE && arg->type != EXPR_FVALUE) value = 0; - } END_FOR_EACH_PTR; + } END_FOR_EACH_PTR(arg); expr->type = EXPR_VALUE; expr->value = value; |