summaryrefslogtreecommitdiffhomepage
path: root/ir/be
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2019-03-25 13:06:07 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2019-03-25 13:06:07 +0100
commit026e48ad8cbd83a608c1132443fa5064c0bb686a (patch)
tree7e6525542b0f622a1f6049405fea3deb34506de7 /ir/be
parent6058dbb9789dbd6952089b73fd2ec086936461b0 (diff)
Zero out the result struct in x86_create_address_mode() instead of in each caller.
Diffstat (limited to 'ir/be')
-rw-r--r--ir/be/amd64/amd64_transform.c1
-rw-r--r--ir/be/ia32/ia32_transform.c3
-rw-r--r--ir/be/ia32/x86_address_mode.c2
3 files changed, 2 insertions, 4 deletions
diff --git a/ir/be/amd64/amd64_transform.c b/ir/be/amd64/amd64_transform.c
index 0e1b58e..16cdc20 100644
--- a/ir/be/amd64/amd64_transform.c
+++ b/ir/be/amd64/amd64_transform.c
@@ -638,7 +638,6 @@ static bool use_address_matching(ir_mode *mode, match_flags_t flags,
static void perform_address_matching_flags(ir_node *const ptr, int *const arity, ir_node **const in, x86_addr_t *const addr, x86_create_am_flags_t const flags)
{
x86_address_t maddr;
- memset(&maddr, 0, sizeof(maddr));
x86_create_address_mode(&maddr, ptr, flags);
x86_addr_variant_t variant = maddr.variant;
diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c
index a8b8a44..f051e49 100644
--- a/ir/be/ia32/ia32_transform.c
+++ b/ir/be/ia32/ia32_transform.c
@@ -735,7 +735,6 @@ static ir_node *transform_else_noreg(ir_node *const node)
static void build_address_ptr(x86_address_t *const addr, ir_node *const ptr, ir_node *const mem, x86_create_am_flags_t const flags)
{
/* construct load address */
- memset(addr, 0, sizeof(addr[0]));
ia32_create_address_mode(addr, ptr, flags);
addr->base = transform_else_noreg(addr->base);
addr->index = transform_else_noreg(addr->index);
@@ -1448,7 +1447,6 @@ static ir_node *gen_Add(ir_node *node)
* 3. Otherwise -> Lea
*/
x86_address_t addr;
- memset(&addr, 0, sizeof(addr));
ia32_create_address_mode(&addr, node, x86_create_am_force);
dbg_info *dbgi = get_irn_dbg_info(node);
@@ -3987,7 +3985,6 @@ static ir_node *gen_Member(ir_node *node)
dbg_info *dbgi = get_irn_dbg_info(node);
x86_address_t addr;
- memset(&addr, 0, sizeof(addr));
ia32_create_address_mode(&addr, node, x86_create_am_force);
return create_lea_from_address(dbgi, block, &addr);
diff --git a/ir/be/ia32/x86_address_mode.c b/ir/be/ia32/x86_address_mode.c
index 4ba69ad..d17451c 100644
--- a/ir/be/ia32/x86_address_mode.c
+++ b/ir/be/ia32/x86_address_mode.c
@@ -236,6 +236,8 @@ static void add_addr_operand(x86_address_t *const addr, ir_node *const op)
void x86_create_address_mode(x86_address_t *addr, ir_node *node,
x86_create_am_flags_t flags)
{
+ memset(addr, 0, sizeof(*addr));
+
addr->imm.kind = X86_IMM_VALUE;
if (eat_immediate(addr, node, true)) {
addr->variant = addr->ip_base ? X86_ADDR_RIP : X86_ADDR_JUST_IMM;