/** This enumeration flags the stickyness of an entity. */
typedef enum {
- stickyness_unsticky, /**< The entity can be removed from
- the program, unless contraindicated
- by other attributes. Default. */
- stickyness_sticky /**< The entity must remain in the
- program in any case. */
+ stickyness_unsticky, /**< The entity can be removed from
+ the program, unless contraindicated
+ by other attributes. Default. */
+ stickyness_sticky /**< The entity must remain in the
+ program in any case. There might be external
+ callers. */
} ir_stickyness;
/** Get the entity's stickyness. */
ir_entity *ent = get_irg_entity(irg);
ir_address_taken_state state = get_entity_address_taken(ent);
+ /* If an entity is sticky, it might be called from external
+ places (like inline assembler), so do NOT mark it as private. */
if (get_entity_visibility(ent) == visibility_local &&
- state == ir_address_not_taken) {
+ state == ir_address_not_taken &&
+ get_entity_stickyness(ent) != stickyness_sticky) {
ir_type *mtp = get_entity_type(ent);
set_entity_additional_property(ent, mtp_property_private);