Lines Matching refs:sym

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