Lines Matching refs:sym
44 static int show_symbol_expr(struct symbol *sym);
47 static void do_debug_symbol(struct symbol *sym, int indent) in do_debug_symbol() argument
71 if (!sym) in do_debug_symbol()
74 indent, indent_string, typestr[sym->type], in do_debug_symbol()
75 sym->bit_size, sym->ctype.alignment, in do_debug_symbol()
76 modifier_string(sym->ctype.modifiers), show_ident(sym->ident), in do_debug_symbol()
77 show_as(sym->ctype.as), in do_debug_symbol()
78 sym, stream_name(sym->pos.stream), sym->pos.line, sym->pos.pos, in do_debug_symbol()
79 builtin_typename(sym) ?: ""); in do_debug_symbol()
81 FOR_EACH_PTR(sym->ctype.contexts, context) { in do_debug_symbol()
88 if (sym->type == SYM_FN) { in do_debug_symbol()
91 FOR_EACH_PTR(sym->arguments, arg) { in do_debug_symbol()
98 do_debug_symbol(sym->ctype.base_type, indent+2); in do_debug_symbol()
101 void debug_symbol(struct symbol *sym) in debug_symbol() argument
103 do_debug_symbol(sym, 0); in debug_symbol()
178 static void show_struct_member(struct symbol *sym) in show_struct_member() argument
180 …"\t%s:%d:%ld at offset %ld.%d", show_ident(sym->ident), sym->bit_size, sym->ctype.alignment, sym->… in show_struct_member()
186 struct symbol *sym; in show_symbol_list() local
189 FOR_EACH_PTR(list, sym) { in show_symbol_list()
192 show_symbol(sym); in show_symbol_list()
193 } END_FOR_EACH_PTR(sym); in show_symbol_list()
237 struct symbol *sym; member
273 const char *builtin_typename(struct symbol *sym) in builtin_typename() argument
278 if (typenames[i].sym == sym) in builtin_typename()
283 const char *builtin_type_suffix(struct symbol *sym) in builtin_type_suffix() argument
288 if (typenames[i].sym == sym) in builtin_type_suffix()
298 if (&typenames[i].sym->ctype == ctype) in builtin_ctypename()
303 static void do_show_type(struct symbol *sym, struct type_name *name) in do_show_type() argument
313 if (sym && (sym->type != SYM_NODE && sym->type != SYM_ARRAY && in do_show_type()
314 sym->type != SYM_BITFIELD)) { in do_show_type()
321 if (sym && (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM)) in do_show_type()
331 if (!sym) in do_show_type()
334 if ((typename = builtin_typename(sym))) { in do_show_type()
344 switch (sym->type) { in do_show_type()
347 mod = sym->ctype.modifiers; in do_show_type()
348 as = sym->ctype.as; in do_show_type()
350 examine_pointer_target(sym); in do_show_type()
365 prepend(name, "struct %s", show_ident(sym->ident)); in do_show_type()
371 prepend(name, "union %s", show_ident(sym->ident)); in do_show_type()
375 prepend(name, "enum %s ", show_ident(sym->ident)); in do_show_type()
379 if (sym->ident) in do_show_type()
380 append(name, "%s", show_ident(sym->ident)); in do_show_type()
381 mod |= sym->ctype.modifiers; in do_show_type()
382 combine_address_space(sym->pos, &as, sym->ctype.as); in do_show_type()
386 mod |= sym->ctype.modifiers; in do_show_type()
387 combine_address_space(sym->pos, &as, sym->ctype.as); in do_show_type()
388 append(name, ":%d", sym->bit_size); in do_show_type()
392 append(name, "label(%s:%p)", show_ident(sym->ident), sym); in do_show_type()
396 mod |= sym->ctype.modifiers; in do_show_type()
397 combine_address_space(sym->pos, &as, sym->ctype.as); in do_show_type()
403 append(name, "[%lld]", get_expression_value(sym->array_size)); in do_show_type()
407 if (!sym->ident) { in do_show_type()
413 prepend(name, "restricted %s", show_ident(sym->ident)); in do_show_type()
423 prepend(name, "unknown type %d", sym->type); in do_show_type()
427 sym = sym->ctype.base_type; in do_show_type()
441 void show_type(struct symbol *sym) in show_type() argument
447 do_show_type(sym, &name); in show_type()
452 const char *show_typename(struct symbol *sym) in show_typename() argument
458 do_show_type(sym, &name); in show_typename()
463 void show_symbol(struct symbol *sym) in show_symbol() argument
467 if (!sym) in show_symbol()
470 if (sym->ctype.alignment) in show_symbol()
471 printf(".align %ld\n", sym->ctype.alignment); in show_symbol()
473 show_type(sym); in show_symbol()
474 type = sym->ctype.base_type; in show_symbol()
513 if (sym->initializer) { in show_symbol()
515 show_expression(sym->initializer); in show_symbol()
519 static int show_symbol_init(struct symbol *sym);
536 struct symbol *sym; in show_switch_statement() local
548 FOR_EACH_PTR(stmt->switch_case->symbol_list, sym) { in show_switch_statement()
549 struct statement *case_stmt = sym->stmt; in show_switch_statement()
568 printf(": .L%p\n", sym); in show_switch_statement()
569 } END_FOR_EACH_PTR(sym); in show_switch_statement()
580 struct symbol *sym; in show_symbol_decl() local
581 FOR_EACH_PTR(syms, sym) { in show_symbol_decl()
582 show_symbol_init(sym); in show_symbol_decl()
583 } END_FOR_EACH_PTR(sym); in show_symbol_decl()
770 struct symbol *sym = fn->unop->symbol; in show_call_expression() local
771 if (sym->ctype.base_type->type == SYM_FN) in show_call_expression()
772 direct = sym; in show_call_expression()
897 static int show_initialization(struct symbol *sym, struct expression *expr) in show_initialization() argument
906 addr = show_symbol_expr(sym); in show_initialization()
954 static int show_symbol_expr(struct symbol *sym) in show_symbol_expr() argument
958 if (sym->initializer && sym->initializer->type == EXPR_STRING) in show_symbol_expr()
959 return show_string_expr(sym->initializer); in show_symbol_expr()
961 if (sym->ctype.modifiers & (MOD_TOPLEVEL | MOD_EXTERN | MOD_STATIC)) { in show_symbol_expr()
962 printf("\tmovi.%d\t\tv%d,$%s\n", bits_in_pointer, new, show_ident(sym->ident)); in show_symbol_expr()
965 if (sym->ctype.modifiers & MOD_ADDRESSABLE) { in show_symbol_expr()
969 …intf("\taddi.%d\t\tv%d,vFP,$offsetof(%s:%p)\n", bits_in_pointer, new, show_ident(sym->ident), sym); in show_symbol_expr()
973 static int show_symbol_init(struct symbol *sym) in show_symbol_init() argument
975 struct expression *expr = sym->initializer; in show_symbol_init()
982 addr = show_symbol_expr(sym); in show_symbol_init()
1111 int show_symbol_expr_init(struct symbol *sym) in show_symbol_expr_init() argument
1113 struct expression *expr = sym->initializer; in show_symbol_expr_init()
1117 return show_symbol_expr(sym); in show_symbol_expr_init()