1 /* asm86.c - 80X86 assembly intermediate Author: Kees J. Bot
12 expression_t
*new_expr(void)
13 /* Make a new cell to build an expression. */
17 e
= allocate(nil
, sizeof(*e
));
19 e
->left
= e
->middle
= e
->right
= nil
;
25 void del_expr(expression_t
*e
)
26 /* Delete an expression tree. */
29 assert(e
->magic
== 31624);
39 asm86_t
*new_asm86(void)
40 /* Make a new cell to hold an 80X86 instruction. */
44 a
= allocate(nil
, sizeof(*a
));
46 get_file(&a
->file
, &a
->line
);
57 void del_asm86(asm86_t
*a
)
58 /* Delete an 80X86 instruction. */
61 assert(a
->magic
== 37937);
64 deallocate(a
->raw_string
);
69 int isregister(const char *name
)
70 /* True if the string is a register name. Return its size. */
72 static char *regs
[] = {
73 "al", "bl", "cl", "dl", "ah", "bh", "ch", "dh",
74 "ax", "bx", "cx", "dx", "si", "di", "bp", "sp",
75 "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
76 "cs", "ds", "es", "fs", "gs", "ss",
77 "cr0", "cr1", "cr2", "cr3", "cr4",
82 for (reg
= 0; reg
< arraysize(regs
); reg
++) {
83 if (strcmp(name
, regs
[reg
]) == 0)