Do not refetch a value, which we already have.
[libfirm] / ir / be / begnuas.c
index 9d33f2b..c6c0063 100644 (file)
@@ -502,9 +502,9 @@ static void emit_weak(const ir_entity *entity)
 
 static void emit_visibility(const ir_entity *entity)
 {
-       ir_linkage linkage = get_entity_linkage(entity);
+       ir_linkage const linkage = get_entity_linkage(entity);
 
-       if (get_entity_linkage(entity) & IR_LINKAGE_WEAK) {
+       if (linkage & IR_LINKAGE_WEAK) {
                emit_weak(entity);
                /* Note: .weak seems to imply .globl so no need to output .globl */
        } else if (get_entity_visibility(entity) == ir_visibility_external
@@ -1612,9 +1612,6 @@ static void emit_global(be_gas_decl_env_t *env, const ir_entity *entity)
        }
 
        emit_visibility(entity);
-       /* nothing left to do without an initializer */
-       if (!entity_has_definition(entity))
-               return;
 
        if (!is_po2(alignment))
                panic("alignment not a power of 2");
@@ -1627,6 +1624,10 @@ static void emit_global(be_gas_decl_env_t *env, const ir_entity *entity)
                return;
        }
 
+       /* nothing left to do without an initializer */
+       if (!entity_has_definition(entity))
+               return;
+
        /* alignment */
        if (alignment > 1) {
                emit_align(alignment);