trverify: cleanup, check irg.entity == entity.irg
[libfirm] / ir / opt / funccall.c
index 7e70ec5..a5cddd6 100644 (file)
@@ -21,7 +21,6 @@
  * @file
  * @brief   Optimization of function calls.
  * @author  Michael Beck
- * @version $Id$
  */
 #include "config.h"
 
@@ -89,8 +88,8 @@ static void collect_const_and_pure_calls(ir_node *node, void *env)
                /* set the link to NULL for all non-const/pure calls */
                set_irn_link(call, NULL);
                ptr = get_Call_ptr(call);
-               if (is_Global(ptr)) {
-                       ent = get_Global_entity(ptr);
+               if (is_SymConst_addr_ent(ptr)) {
+                       ent = get_SymConst_entity(ptr);
 
                        prop = get_entity_additional_properties(ent);
                        if ((prop & (mtp_property_const|mtp_property_pure)) == 0)
@@ -113,7 +112,7 @@ static void collect_const_and_pure_calls(ir_node *node, void *env)
                        or_prop  = 0;
                        for (i = 0; i < n_callees; ++i) {
                                ent = get_Call_callee(call, i);
-                               if (ent == unknown_entity) {
+                               if (is_unknown_entity(ent)) {
                                        /* we don't know which entity is called here */
                                        return;
                                }
@@ -262,8 +261,8 @@ static void collect_nothrow_calls(ir_node *node, void *env)
                /* set the link to NULL for all non-const/pure calls */
                set_irn_link(call, NULL);
                ptr = get_Call_ptr(call);
-               if (is_Global(ptr)) {
-                       ent = get_Global_entity(ptr);
+               if (is_SymConst_addr_ent(ptr)) {
+                       ent = get_SymConst_entity(ptr);
 
                        prop = get_entity_additional_properties(ent);
                        if ((prop & mtp_property_nothrow) == 0)
@@ -285,7 +284,7 @@ static void collect_nothrow_calls(ir_node *node, void *env)
                        prop = mtp_property_nothrow;
                        for (i = 0; i < n_callees; ++i) {
                                ent = get_Call_callee(call, i);
-                               if (ent == unknown_entity) {
+                               if (is_unknown_entity(ent)) {
                                        /* we don't know which entity is called here */
                                        return;
                                }
@@ -725,8 +724,8 @@ static int is_stored(const ir_node *n)
                        break;
                case iro_Call:
                        ptr = get_Call_ptr(succ);
-                       if (is_Global(ptr)) {
-                               ir_entity *ent = get_Global_entity(ptr);
+                       if (is_SymConst_addr_ent(ptr)) {
+                               ir_entity *ent = get_SymConst_entity(ptr);
                                size_t    i;
 
                                /* we know the called entity */
@@ -838,9 +837,9 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
                                        } else if (is_Call(res)) {
                                                ir_node *ptr = get_Call_ptr(res);
 
-                                               if (is_Global(ptr)) {
+                                               if (is_SymConst_addr_ent(ptr)) {
                                                        /* a direct call */
-                                                       ir_entity *ent    = get_Global_entity(ptr);
+                                                       ir_entity *ent    = get_SymConst_entity(ptr);
                                                        ir_graph  *callee = get_entity_irg(ent);
 
                                                        if (callee == irg) {
@@ -866,7 +865,7 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
 
                                                        for (i = 0; i < n_callees; ++i) {
                                                                ir_entity *ent = get_Call_callee(res, i);
-                                                               if (ent == unknown_entity) {
+                                                               if (is_unknown_entity(ent)) {
                                                                        /* we don't know which entity is called here */
                                                                        curr_prop &= ~mtp_property_malloc;
                                                                        break;
@@ -894,9 +893,9 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
                        if (is_Call(pred)) {
                                ir_node *ptr = get_Call_ptr(pred);
 
-                               if (is_Global(ptr)) {
+                               if (is_SymConst_addr_ent(ptr)) {
                                        /* a direct call */
-                                       ir_entity *ent    = get_Global_entity(ptr);
+                                       ir_entity *ent    = get_SymConst_entity(ptr);
                                        ir_graph  *callee = get_entity_irg(ent);
 
                                        if (callee == irg) {
@@ -924,7 +923,7 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
 
                                        for (i = 0; i < n_callees; ++i) {
                                                ir_entity *ent = get_Call_callee(pred, i);
-                                               if (ent == unknown_entity) {
+                                               if (is_unknown_entity(ent)) {
                                                        /* we don't know which entity is called here */
                                                        curr_prop &= ~mtp_property_nothrow;
                                                        break;