summaryrefslogtreecommitdiffhomepage
path: root/ir/be/mips
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2017-01-14 07:46:27 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2017-01-14 07:46:27 +0100
commitd7301188136ab2e9b54f46f774bb13c7a842ebac (patch)
treeefb1b9393e4d49aa28494a863843839692fa5008 /ir/be/mips
parent25013743d368a58623b786901f7fe3c7360d69df (diff)
mips: Improve matching of addresses.
Fold small constant offsets.
Diffstat (limited to 'ir/be/mips')
-rw-r--r--ir/be/mips/mips_transform.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ir/be/mips/mips_transform.c b/ir/be/mips/mips_transform.c
index 2187182..ecc0e18 100644
--- a/ir/be/mips/mips_transform.c
+++ b/ir/be/mips/mips_transform.c
@@ -92,13 +92,27 @@ typedef struct mips_addr {
static mips_addr make_addr(ir_node *addr)
{
ir_entity *ent = 0;
+ int32_t val = 0;
+
+ if (is_Add(addr)) {
+ ir_node *const r = get_Add_right(addr);
+ if (is_Const(r)) {
+ long const v = get_Const_long(r);
+ if (is_simm16(v)) {
+ val = v;
+ addr = get_Add_left(addr);
+ }
+ }
+ }
+
if (is_Member(addr)) {
ent = get_Member_entity(addr);
addr = get_Member_ptr(addr);
assert(is_Proj(addr) && get_Proj_num(addr) == pn_Start_P_frame_base && is_Start(get_Proj_pred(addr)));
}
+
ir_node *const base = be_transform_node(addr);
- return (mips_addr){ base, ent, 0 };
+ return (mips_addr){ base, ent, val };
}
static ir_node *make_address(ir_node const *const node, ir_entity *const ent, int32_t const val)