summaryrefslogtreecommitdiffhomepage
path: root/ir/be/betranshlp.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-05-04 12:13:37 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-05-04 12:13:37 +0200
commite530cba364dc74d5912885f8d3d43cb4207e435a (patch)
tree9ad15cf53998bb43432d520efa9a31b9aab2267a /ir/be/betranshlp.c
parentcc875763bae5b5bca219b224455942ecae7ba27d (diff)
be: Fix matching 'Add(Address/Relocation, Const)' in 'be_match_immediate()'.
It checked for Const on the wrong side, so it always failed. Then the code further down used the wrong accessor functions.
Diffstat (limited to 'ir/be/betranshlp.c')
-rw-r--r--ir/be/betranshlp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ir/be/betranshlp.c b/ir/be/betranshlp.c
index 97773a4..6cf7c5e 100644
--- a/ir/be/betranshlp.c
+++ b/ir/be/betranshlp.c
@@ -896,15 +896,15 @@ bool be_match_immediate(ir_node const *const node, ir_tarval **const tarval_out,
l = r;
r = tmp;
}
- if (!is_Const(l))
+ if (!is_Const(r))
return false;
- cnst = l;
- if (is_Address(r)) {
- entity = get_Address_entity(node);
+ cnst = r;
+ if (is_Address(l)) {
+ entity = get_Address_entity(l);
reloc_kind = 0;
- } else if (be_is_Relocation(r)) {
- entity = get_Address_entity(node);
- reloc_kind = be_get_Relocation_kind(node);
+ } else if (be_is_Relocation(l)) {
+ entity = be_get_Relocation_entity(l);
+ reloc_kind = be_get_Relocation_kind(l);
} else {
return false;
}