atom
au_to_xatom(char *atom)
len = strlen(atom) + 1;
adr_char(&adr, atom, len);
Dwarf_Small atom = 0;
atom = *(Dwarf_Small *) loc_ptr;
curr_loc->lr_atom = atom;
switch (atom) {
operand1 = atom - DW_OP_lit0;
curr_loc->lr_atom = atom;
atom_t *atom;
if ((atom = dict_get(_pv_atoms, s)) == NULL) {
if ((atom = calloc(1, sizeof (atom_t))) == NULL) {
if ((atom->a_string = strdup(s)) == NULL) {
free(atom);
(void) dict_put(_pv_atoms, atom->a_string, atom);
atom->a_count++;
return (atom->a_string);
atom_t *atom;
if ((atom = dict_get(_pv_atoms, s)) != NULL) {
if (--atom->a_count == 0) {
free(atom->a_string);
free(atom);
static struct atom *new_atom(enum atom_type type)
struct atom *atom;
atom = calloc(1, sizeof(*atom)); /* TODO: chunked alloc */
if (!atom)
atom->type = type;
return atom;
struct atom *atom;
atom = new_atom(ATOM_CSTR);
atom->string = str;
atom->label = label;
add_ptr_list(&f->str_list, atom); /* note: _not_ atom_list */
static inline void push_atom(struct function *f, struct atom *atom)
add_ptr_list(&f->atom_list, atom);
struct atom *atom = new_atom(ATOM_TEXT);
atom->text = strdup(text);
atom->text_len = strlen(text);
push_atom(f, atom);
struct atom *atom = new_atom(ATOM_INSN);
strcpy(atom->insn, insn);
strncpy(atom->comment, comment_in,
sizeof(atom->comment) - 1);
atom->op1 = op1;
atom->op2 = op2;
push_atom(f, atom);
static void emit_insn_atom(struct function *f, struct atom *atom)
struct storage *op1 = atom->op1;
struct storage *op2 = atom->op2;
if (atom->comment[0])
sprintf(comment, "\t\t# %s", atom->comment);
if (atom->op2) {
atom->insn, tmp, stor_op_name(op2), comment);
} else if (atom->op1)
atom->insn, stor_op_name(op1),
atom->insn,
struct atom *atom;
FOR_EACH_PTR(f->atom_list, atom) {
switch (atom->type) {
if (write(STDOUT_FILENO, atom->text, atom->text_len) < 0)
struct atom;
emit_insn_atom(f, atom);
} END_FOR_EACH_PTR(atom);
struct atom *atom;
FOR_EACH_PTR(f->str_list, atom) {
printf(".L%d:\n", atom->label);
printf("\t.string\t%s\n", show_string(atom->string));
DECLARE_PTR_LIST(str_list, struct atom);
free(atom);
} END_FOR_EACH_PTR(atom);
struct atom *atom;
DECLARE_PTR_LIST(atom_list, struct atom);
FOR_EACH_PTR(f->atom_list, atom) {
if ((atom->type == ATOM_TEXT) && (atom->text))
free(atom->text);
if (atom->op1 && (atom->op1->flags & STOR_WANTS_FREE))
free(atom->op1);
if (atom->op2 && (atom->op2->flags & STOR_WANTS_FREE))
free(atom->op2);
free(atom);
} END_FOR_EACH_PTR(atom);