summaryrefslogtreecommitdiffhomepage
path: root/ir/be/ia32
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-09-03 13:15:17 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2018-09-19 06:20:46 +0200
commitaafd568a762f93fdef5a2d973c4f253b56eaaa25 (patch)
tree209bbc8092c5d11a16d2738e527119f803806d4f /ir/be/ia32
parent4ad71cb839608094e69f1e72c99f990d279e6dcd (diff)
ia32: Use set_indexed_ent().
Diffstat (limited to 'ir/be/ia32')
-rw-r--r--ir/be/ia32/ia32_transform.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c
index 1d0705c..d2d3e10 100644
--- a/ir/be/ia32/ia32_transform.c
+++ b/ir/be/ia32/ia32_transform.c
@@ -791,6 +791,20 @@ static void set_address(ir_node *node, const x86_address_t *addr)
set_ia32_frame_use(node, IA32_FRAME_USE_AUTO);
}
+static void set_indexed_ent(ir_node *const node, unsigned const scale, ir_entity *const ent)
+{
+ x86_address_t const addr = {
+ .variant = ir_platform.pic_style != BE_PIC_NONE ? X86_ADDR_BASE_INDEX : X86_ADDR_INDEX,
+ .scale = scale,
+ .imm = {
+ .kind = lconst_imm_kind,
+ .entity = ent,
+ },
+ };
+ set_address(node, &addr);
+ set_ia32_op_type(node, ia32_AddrModeS);
+}
+
/**
* Apply attributes of a given address mode to a node.
*/
@@ -2795,17 +2809,7 @@ static ir_node *gen_Switch(ir_node *node)
switchjmp = new_bd_ia32_SwitchJmp(dbgi, block, add, noreg_GP, n_outs,
table, entity);
}
- ia32_attr_t *attr = get_ia32_attr(table_am);
- attr->addr = (x86_addr_t) {
- .immediate = {
- .kind = lconst_imm_kind,
- .entity = entity,
- },
- .log_scale = 2,
- .variant = ir_platform.pic_style != BE_PIC_NONE
- ? X86_ADDR_BASE_INDEX : X86_ADDR_INDEX,
- };
- set_ia32_op_type(table_am, ia32_AddrModeS);
+ set_indexed_ent(table_am, 2, entity);
return switchjmp;
}
@@ -3340,20 +3344,6 @@ static ir_node *create_Conv_I2I(dbg_info *dbgi, ir_node *block, ir_node *base,
return func(dbgi, block, base, index, mem, val, size, sign_extend);
}
-static void set_indexed_ent(ir_node *const node, unsigned const scale, ir_entity *const ent)
-{
- x86_address_t const addr = {
- .variant = ir_platform.pic_style != BE_PIC_NONE ? X86_ADDR_BASE_INDEX : X86_ADDR_INDEX,
- .scale = scale,
- .imm = {
- .kind = lconst_imm_kind,
- .entity = ent,
- },
- };
- set_address(node, &addr);
- set_ia32_op_type(node, ia32_AddrModeS);
-}
-
/**
* Transforms a Mux node into some code sequence.
*