/** Returns the @link unknown_entity unknown entity @endlink. */
FIRM_API ir_entity *get_unknown_entity(void);
+/** Tests whether entity @p entity is (the) unknown entity.
+ * @returns 1 if it is the unknown entity, 0 otherwise */
+FIRM_API int is_unknown_entity(const ir_entity *entity);
+
/** @deprecated */
typedef enum {
allocation_automatic,
FIRM_API ir_type *firm_none_type;
/** Returns the none type. */
FIRM_API ir_type *get_none_type(void);
+/** Checks whether type @p type is the none type. */
+FIRM_API int is_none_type(const ir_type *type);
/**
* This type opcode is an auxiliary opcode dedicated to support type analyses.
*
FIRM_API ir_type *firm_unknown_type;
/** Returns the unknown type. */
FIRM_API ir_type *get_unknown_type(void);
+/** Checks whether type @p type is the unknown type */
+FIRM_API int is_unknown_type(const ir_type *type);
/**
* This type opcode is an auxiliary opcode dedicated to support type analyses.
*
ent->attr.mtd_attr.vtable_number = vtable_number;
}
+int is_unknown_entity(const ir_entity *entity)
+{
+ return entity->entity_kind == IR_ENTITY_UNKNOWN;
+}
+
int (is_entity)(const void *thing)
{
return _is_entity(thing);
void ir_init_entity(void)
{
+ ident *id = new_id_from_str(UNKNOWN_ENTITY_NAME);
+
assert(firm_unknown_type && "Call init_type() before firm_init_entity()!");
assert(!unknown_entity && "Call firm_init_entity() only once!");
- unknown_entity = new_d_entity(NULL, new_id_from_str(UNKNOWN_ENTITY_NAME),
- firm_unknown_type, NULL);
+ unknown_entity = intern_new_entity(NULL, IR_ENTITY_UNKNOWN, id,
+ firm_unknown_type, NULL);
set_entity_visibility(unknown_entity, ir_visibility_external);
set_entity_ld_ident(unknown_entity, get_entity_ident(unknown_entity));
+ hook_new_entity(unknown_entity);
}
void ir_finish_entity(void)
IR_ENTITY_COMPOUND_MEMBER,
IR_ENTITY_PARAMETER,
IR_ENTITY_LABEL,
+ IR_ENTITY_UNKNOWN,
} ir_entity_kind;
/**
}
}
-
-
int is_code_type(const ir_type *tp)
{
- assert(tp && tp->kind == k_type);
+ assert(tp->kind == k_type);
return tp->type_op == tpop_code;
}
+int is_unknown_type(const ir_type *tp)
+{
+ assert(tp->kind == k_type);
+ return tp->type_op == tpop_unknown;
+}
+
+int is_none_type(const ir_type *tp)
+{
+ assert(tp->kind == k_type);
+ return tp->type_op == tpop_none;
+}
+
int is_frame_type(const ir_type *tp)
{
return tp->flags & tf_frame_type;