summaryrefslogtreecommitdiffhomepage
path: root/ir/be/mips
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-05-08 12:05:00 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2018-05-08 12:05:00 +0200
commit46210b81e457b068ae83f19ee7d4f1a3a05a9a77 (patch)
tree21cd970bccfabd633915d434b0d4a2973b39228d /ir/be/mips
parent314369bc156ad55385d5d761e0013ff8d9f13549 (diff)
be: Use a common struct to hold basic asm operand information.
Diffstat (limited to 'ir/be/mips')
-rw-r--r--ir/be/mips/mips_emitter.c10
-rw-r--r--ir/be/mips/mips_nodes_attr.h7
-rw-r--r--ir/be/mips/mips_transform.c13
3 files changed, 13 insertions, 17 deletions
diff --git a/ir/be/mips/mips_emitter.c b/ir/be/mips/mips_emitter.c
index 5b8504e..a482d99 100644
--- a/ir/be/mips/mips_emitter.c
+++ b/ir/be/mips/mips_emitter.c
@@ -103,19 +103,19 @@ static void emit_mips_asm_operand(ir_node const *const node, char const modifier
mips_asm_operand_t const *const op = &((mips_asm_operand_t const*)attr->operands)[pos];
/* modifiers:
* z: print normally, except immediate 0 as '$zero' */
- if (!be_is_valid_asm_operand_kind(node, modifier, pos, op->kind, "z", "", ""))
+ if (!be_is_valid_asm_operand_kind(node, modifier, pos, op->op.kind, "z", "", ""))
return;
- switch (op->kind) {
+ switch (op->op.kind) {
case BE_ASM_OPERAND_INVALID:
panic("invalid asm operand");
case BE_ASM_OPERAND_INPUT_VALUE:
- emit_register(arch_get_irn_register_in(node, op->pos));
+ emit_register(arch_get_irn_register_in(node, op->op.pos));
return;
case BE_ASM_OPERAND_OUTPUT_VALUE:
- emit_register(arch_get_irn_register_out(node, op->pos));
+ emit_register(arch_get_irn_register_out(node, op->op.pos));
return;
case BE_ASM_OPERAND_IMMEDIATE:
@@ -127,7 +127,7 @@ static void emit_mips_asm_operand(ir_node const *const node, char const modifier
case BE_ASM_OPERAND_MEMORY:
be_emit_char('(');
- emit_register(arch_get_irn_register_in(node, op->pos));
+ emit_register(arch_get_irn_register_in(node, op->op.pos));
be_emit_char(')');
return;
}
diff --git a/ir/be/mips/mips_nodes_attr.h b/ir/be/mips/mips_nodes_attr.h
index e010ef2..39d5ecd 100644
--- a/ir/be/mips/mips_nodes_attr.h
+++ b/ir/be/mips/mips_nodes_attr.h
@@ -32,10 +32,9 @@ static inline mips_cond_t mips_negate_cond(mips_cond_t const c)
}
typedef struct mips_asm_operand_t {
- be_asm_operand_kind_t kind;
- unsigned pos;
- int32_t val;
- ir_entity *ent;
+ be_asm_operand_t op;
+ int32_t val;
+ ir_entity *ent;
} mips_asm_operand_t;
typedef struct mips_cond_attr_t {
diff --git a/ir/be/mips/mips_transform.c b/ir/be/mips/mips_transform.c
index 67fd446..16eb23d 100644
--- a/ir/be/mips/mips_transform.c
+++ b/ir/be/mips/mips_transform.c
@@ -245,9 +245,9 @@ static bool mips_match_immediate(mips_asm_operand_t *const operand, ir_node *con
value = 0;
}
- operand->kind = BE_ASM_OPERAND_IMMEDIATE;
- operand->val = value;
- operand->ent = entity;
+ be_set_asm_operand(&operand->op, BE_ASM_OPERAND_IMMEDIATE, -1);
+ operand->val = value;
+ operand->ent = entity;
return true;
}
@@ -274,9 +274,7 @@ static ir_node *gen_ASM(ir_node *const node)
arch_register_req_t const *const req = be_make_register_req(obst, &parsed_constraint, n_out_constraints, out_reqs, o);
ARR_APP1(arch_register_req_t const*, out_reqs, req);
- mips_asm_operand_t *const operand = &operands[constraint->pos];
- operand->kind = BE_ASM_OPERAND_OUTPUT_VALUE;
- operand->pos = o;
+ be_set_asm_operand(&operands[constraint->pos].op, BE_ASM_OPERAND_OUTPUT_VALUE, o);
}
ir_node **in = NEW_ARR_F(ir_node*, 0);
@@ -304,8 +302,7 @@ static ir_node *gen_ASM(ir_node *const node)
req = arch_get_irn_register_req(new_pred)->cls->class_req;
}
- operand->kind = kind;
- operand->pos = ARR_LEN(in);
+ be_set_asm_operand(&operand->op, kind, ARR_LEN(in));
ARR_APP1(ir_node*, in, new_pred);
ARR_APP1(arch_register_req_t const*, in_reqs, req);
}