GCC: __attribute__((naked)). */
mtp_property_malloc = 0x00000020, /**< This method returns newly allocate memory.
GCC: __attribute__((malloc)). */
- mtp_property_weak = 0x00000040, /**< This method is weak. It is expected that
- GCC: __attribute__((weak)). */
- mtp_property_returns_twice = 0x00000080, /**< This method can return more than one (typically setjmp).
+ mtp_property_returns_twice = 0x00000040, /**< This method can return more than one (typically setjmp).
GCC: __attribute__((returns_twice)). */
- mtp_property_intrinsic = 0x00000100, /**< This method is intrinsic. It is expected that
+ mtp_property_intrinsic = 0x00000080, /**< This method is intrinsic. It is expected that
a lowering phase will remove all calls to it. */
- mtp_property_runtime = 0x00000200, /**< This method represents a runtime routine. */
- mtp_property_private = 0x00000400, /**< All method invocations are known, the backend is free to
+ mtp_property_runtime = 0x00000100, /**< This method represents a runtime routine. */
+ mtp_property_private = 0x00000200, /**< All method invocations are known, the backend is free to
optimize the call in any possible way. */
- mtp_property_has_loop = 0x00000800, /**< Set, if this method contains one possible endless loop. */
+ mtp_property_has_loop = 0x00000400, /**< Set, if this method contains one possible endless loop. */
mtp_property_inherited = (1<<31) /**< Internal. Used only in irg's, means property is
inherited from type. */
} mtp_additional_property;
if (mask & mtp_property_nothrow) fputs("nothrow_function, ", F);
if (mask & mtp_property_naked) fputs("naked_function, ", F);
if (mask & mtp_property_malloc) fputs("malloc_function, ", F);
- if (mask & mtp_property_weak) fputs("weak_function, ", F);
if (mask & mtp_property_returns_twice) fputs("weak_function, ", F);
if (mask & mtp_property_intrinsic) fputs("intrinsic_function, ", F);
if (mask & mtp_property_runtime) fputs("runtime_function, ", F);
*
* @param call the call node
*/
-static ir_graph *get_call_called_irg(ir_node *call) {
+static ir_graph *get_call_called_irg(ir_node *call)
+{
ir_node *addr;
addr = get_Call_ptr(call);
if (is_Global(addr)) {
ir_entity *ent = get_Global_entity(addr);
+ /* we don't know which function gets finally bound to a weak symbol */
+ if (get_entity_linkage(ent) & IR_LINKAGE_WEAK)
+ return NULL;
+
return get_entity_irg(ent);
}
ir_graph *callee = entry->callee;
irg_inline_property prop = get_irg_inline_property(callee);
- if (prop == irg_inline_forbidden || get_irg_additional_properties(callee) & mtp_property_weak) {
- /* do not inline forbidden / weak graphs */
+ if (prop == irg_inline_forbidden) {
continue;
}
callee = entry->callee;
prop = get_irg_inline_property(callee);
- if (prop == irg_inline_forbidden || get_irg_additional_properties(callee) & mtp_property_weak) {
- /* do not inline forbidden / weak graphs */
+ if (prop == irg_inline_forbidden) {
continue;
}
callee = entry->callee;
prop = get_irg_inline_property(callee);
- if (prop == irg_inline_forbidden || get_irg_additional_properties(callee) & mtp_property_weak) {
- /* do not inline forbidden / weak graphs */
+ if (prop == irg_inline_forbidden) {
continue;
}
return entry->benefice = INT_MIN;
}
- if (get_irg_additional_properties(callee) & (mtp_property_noreturn | mtp_property_weak)) {
+ if (get_irg_additional_properties(callee) & mtp_property_noreturn) {
DB((dbg, LEVEL_2, "In %+F Call to %+F: not inlining noreturn or weak\n",
call, callee));
return entry->benefice = INT_MIN;
callee = get_Global_entity(call_ptr);
- /* we can only clone calls to existing entities */
- if (get_entity_irg(callee) == NULL)
+ /* we don't know which function gets finally bound to a weak symbol */
+ if (get_entity_linkage(callee) & IR_LINKAGE_WEAK)
return;
- /* we cannot clone calls to weak functions */
- if (get_entity_additional_properties(callee) & mtp_property_weak)
+ /* we can only clone calls to existing entities */
+ if (get_entity_irg(callee) == NULL)
return;
process_call(call, callee, hmap);
/* local and extern are mutually exclusive */
(void) linkage;
assert(! ((linkage & IR_LINKAGE_EXTERN) && (linkage & IR_LINKAGE_LOCAL)));
- assert(! (linkage & IR_LINKAGE_EXTERN) || !entity_has_definition(entity));
+ if (!is_method_entity(entity) && (linkage & IR_LINKAGE_EXTERN)) {
+ assert(!entity_has_definition(entity));
+ }
+ assert(! ((linkage & IR_LINKAGE_CONSTANT) && (linkage & IR_LINKAGE_WEAK)));
}
void set_entity_linkage(ir_entity *entity, ir_linkage linkage)
case tpo_struct:
for (i = 0; i < get_struct_n_members(tp); i++) {
assert(get_entity_offset(get_struct_member(tp, i)) > -1);
- assert((get_entity_allocation(get_struct_member(tp, i)) == allocation_automatic));
}
break;
case tpo_union: