static void emit_data_charptr(char *s, int depth) { char *label = make_label(); emit(".data %d", depth + 1); emit_label(label); emit(".string \"%s\"", quote_cstring(s)); emit(".data %d", depth); emit(".quad %s", label); }
static void emit_literal_string(Node *node) { SAVE; if (!node->slabel) { node->slabel = make_label(); emit_noindent(".data"); emit_label(node->slabel); emit(".string \"%s\"", quote_cstring(node->sval)); emit_noindent(".text"); } emit("lea %s(%%rip), %%rax", node->slabel); }
static void maybe_print_source_loc(Node *node) { if (!node->sourceLoc) return; char *file = node->sourceLoc->file; long fileno = (long)map_get(source_files, file); if (!fileno) { fileno = map_len(source_files) + 1; map_put(source_files, file, (void *)fileno); emit(".file %ld \"%s\"", fileno, quote_cstring(file)); } char *loc = format(".loc %ld %d 0", fileno, node->sourceLoc->line); if (strcmp(loc, last_loc)) { emit("%s", loc); maybe_print_source_line(file, node->sourceLoc->line); } last_loc = loc; }