- int rem_vpi;
- ir_type *tp = get_entity_type(ent);
- ir_type *owner = get_entity_owner(ent);
-
- current_ir_graph = get_const_code_irg();
- ASSERT_AND_RET_DBG(
- constants_on_wrong_irg(ent) == 0,
- "Contants placed on wrong IRG",
- error_const_on_wrong_irg,
- ir_fprintf(stderr, "%+e not on %+F\n", ent, current_ir_graph));
-
- rem_vpi = get_visit_pseudo_irgs();
- set_visit_pseudo_irgs(1);
- if ((get_entity_peculiarity(ent) == peculiarity_existent) &&
- (get_entity_visibility(ent) != visibility_external_allocated) &&
- (is_Method_type(get_entity_type(ent))) &&
- (!get_entity_irg(ent) || !(is_ir_graph(get_entity_irg(ent))))) {
- ASSERT_AND_RET_DBG(
- 0,
- "Method ents with pec_exist must have an irg",
- error_existent_entity_without_irg,
- ir_fprintf(stderr, "%+e\n", ent)
- );
- }
- set_visit_pseudo_irgs(rem_vpi);
-
- /* Originally, this test assumed, that only method entities have
- pecularity_inherited. As I changed this, I have to test for method type before
- doing the test. */
- if (get_entity_peculiarity(ent) == peculiarity_inherited) {
- if (is_Method_type(get_entity_type(ent))) {
- ir_entity *impl = get_SymConst_entity(get_atomic_ent_value(ent));
- ASSERT_AND_RET_DBG(
- get_entity_peculiarity(impl) == peculiarity_existent,
- "inherited method entities must have constant pointing to existent entity.",
- error_inherited_ent_without_const,
- ir_fprintf(stderr, "%+e points to %+e\n", ent, impl)
- );
- }
- }
-
- /* Entities in global type are not dynamic or automatic allocated. */
- if (owner == get_glob_type()) {
- ASSERT_AND_RET_DBG(
- get_entity_allocation(ent) != allocation_dynamic &&
- get_entity_allocation(ent) != allocation_automatic,
- "Entities in global type are not allowed to by dynamic or automatic allocated",
- error_glob_ent_allocation,
- show_ent_alloc_error(ent)
- );
- }
-
- if (get_entity_variability(ent) != variability_uninitialized) {
- if (is_atomic_type(tp)) {
- ir_node *val = get_atomic_ent_value(ent);
- if (val)
- ASSERT_AND_RET_DBG(
- get_irn_mode(val) == get_type_mode(tp),
- "Mode of constant in entity must match type.",
- error_ent_const_mode,
- ir_fprintf(stderr, "%+e const %+F, type %+F(%+F)\n",
- ent, val, tp, get_type_mode(tp))
- );
- }
- }
- return no_error;
+ int rem_vpi;
+ ir_type *tp = get_entity_type(ent);
+ ir_type *owner = get_entity_owner(ent);
+
+ current_ir_graph = get_const_code_irg();
+ ASSERT_AND_RET_DBG(
+ constants_on_wrong_irg(ent) == 0,
+ "Contants placed on wrong IRG",
+ error_const_on_wrong_irg,
+ ir_fprintf(stderr, "%+e not on %+F\n", ent, current_ir_graph)
+ );
+
+ rem_vpi = get_visit_pseudo_irgs();
+ set_visit_pseudo_irgs(1);
+ if ((get_entity_peculiarity(ent) == peculiarity_existent) &&
+ (get_entity_visibility(ent) != visibility_external_allocated) &&
+ (is_Method_type(get_entity_type(ent))) &&
+ (!get_entity_irg(ent) || !(is_ir_graph(get_entity_irg(ent))))) {
+ ASSERT_AND_RET_DBG(
+ 0,
+ "Method ents with pec_exist must have an irg",
+ error_existent_entity_without_irg,
+ ir_fprintf(stderr, "%+e\n", ent)
+ );
+ }
+ set_visit_pseudo_irgs(rem_vpi);
+
+ /* Originally, this test assumed, that only method entities have
+ pecularity_inherited. As I changed this, I have to test for method type before
+ doing the test. */
+ if (get_entity_peculiarity(ent) == peculiarity_inherited) {
+ if (is_Method_type(get_entity_type(ent))) {
+ ir_entity *impl = get_SymConst_entity(get_atomic_ent_value(ent));
+ ASSERT_AND_RET_DBG(
+ get_entity_peculiarity(impl) == peculiarity_existent,
+ "inherited method entities must have constant pointing to existent entity.",
+ error_inherited_ent_without_const,
+ ir_fprintf(stderr, "%+e points to %+e\n", ent, impl)
+ );
+ }
+ }
+
+ /* Entities in global type are not dynamic or automatic allocated. */
+ if (owner == get_glob_type()) {
+ ASSERT_AND_RET_DBG(
+ get_entity_allocation(ent) != allocation_dynamic &&
+ get_entity_allocation(ent) != allocation_automatic,
+ "Entities in global type are not allowed to by dynamic or automatic allocated",
+ error_glob_ent_allocation,
+ show_ent_alloc_error(ent)
+ );
+ }
+
+ if (get_entity_variability(ent) != variability_uninitialized) {
+ if (is_atomic_type(tp)) {
+ ir_node *val = get_atomic_ent_value(ent);
+ if (val) {
+ ASSERT_AND_RET_DBG(
+ get_irn_mode(val) == get_type_mode(tp),
+ "Mode of constant in entity must match type.",
+ error_ent_const_mode,
+ ir_fprintf(stderr, "%+e const %+F, type %+F(%+F)\n",
+ ent, val, tp, get_type_mode(tp))
+ );
+ }
+ }
+ }
+ return no_error;