Commit 81df5bee authored by Christoph Mallon's avatar Christoph Mallon
Browse files

amd64: Dump the AM variant.

parent 13ca75d8
......@@ -159,8 +159,12 @@ static void amd64_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
if (amd64_has_addr_attr(n)) {
const amd64_addr_attr_t *addr_attr = get_amd64_addr_attr_const(n);
fprintf(F, "size = %s\n", get_insn_mode_string(addr_attr->insn_mode));
fprintf(F, "base input: %d\n", addr_attr->addr.base_input);
fprintf(F, "index input: %d\n", addr_attr->addr.index_input);
x86_addr_variant_t const variant = addr_attr->addr.variant;
fprintf(F, "am variant = %s\n", x86_get_addr_variant_str(variant));
if (x86_addr_variant_has_base(variant))
fprintf(F, "base input: %d\n", addr_attr->addr.base_input);
if (x86_addr_variant_has_index(variant))
fprintf(F, "index input: %d\n", addr_attr->addr.index_input);
fputs("am imm: ", F);
x86_dump_imm32(&addr_attr->addr.immediate, F);
fputc('\n', F);
......
......@@ -467,3 +467,16 @@ void x86_free_non_address_mode_nodes(void)
{
free(non_address_mode_nodes);
}
char const *x86_get_addr_variant_str(x86_addr_variant_t const variant)
{
switch (variant) {
case X86_ADDR_INVALID: return "invalid";
case X86_ADDR_JUST_IMM: return "immediate";
case X86_ADDR_BASE: return "base";
case X86_ADDR_BASE_INDEX: return "base+index";
case X86_ADDR_INDEX: return "index";
case X86_ADDR_RIP: return "rip";
}
return "<BAD>";
}
......@@ -25,6 +25,8 @@ typedef enum {
X86_ADDR_RIP,
} x86_addr_variant_t;
char const *x86_get_addr_variant_str(x86_addr_variant_t);
static inline bool x86_addr_variant_has_base(x86_addr_variant_t const variant)
{
return variant == X86_ADDR_BASE || variant == X86_ADDR_BASE_INDEX;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment