add prefer_fastcall
[libfirm] / ir / be / beverify.c
index 62ee7d5..3f533c3 100644 (file)
@@ -1,9 +1,28 @@
 /*
- * Author:    Matthias Braun
- * Date:      05.05.2006
- * Copyright: (c) Universitaet Karlsruhe
- * License:   This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- * CVS-Id:    $Id$
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief       Various verify routines that check a scheduled graph for correctness.
+ * @author      Matthias Braun
+ * @date        05.05.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -26,6 +45,8 @@
 #include "belive.h"
 #include "besched_t.h"
 #include "benode_t.h"
+#include "beirg_t.h"
+#include "beintlive_t.h"
 
 static int my_values_interfere(const ir_node *a, const ir_node *b);
 
@@ -92,7 +113,9 @@ static void verify_liveness_walker(ir_node *block, void *data) {
 /**
  * Start a walk over the irg and check the register pressure.
  */
-int be_verify_register_pressure(const be_irg_t *birg, const arch_register_class_t *cls, ir_graph *irg) {
+int be_verify_register_pressure(const be_irg_t *birg,
+                                const arch_register_class_t *cls,
+                                ir_graph *irg) {
        be_verify_register_pressure_env_t env;
 
        env.lv                  = be_liveness(irg);
@@ -242,8 +265,11 @@ static int should_be_scheduled(be_verify_schedule_env_t *env, ir_node *node) {
                if(is_Phi(node) || is_Sync(node) || is_Pin(node))
                        return 0;
        }
-       if(is_Proj(node) && get_irn_mode(node) == mode_X)
-               return 0;
+       if(is_Proj(node)) {
+               if(get_irn_mode(node) == mode_X)
+                       return 0;
+               return should_be_scheduled(env, get_Proj_pred(node));
+       }
        if(be_is_Keep(node) && get_irn_opcode(get_nodes_block(node)) == iro_Bad)
                return 0;
 
@@ -363,18 +389,21 @@ static ir_node *get_memory_edge(const ir_node *node) {
        return result;
 }
 
-static void collect(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent);
+static
+void collect(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent);
 
-static void check_entity(be_verify_spillslots_env_t *env, ir_node *node, ir_entity *ent) {
+static
+void be_check_entity(be_verify_spillslots_env_t *env, ir_node *node, ir_entity *ent) {
        if(ent == NULL) {
                ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) should have an entity assigned\n",
                           node, get_nodes_block(node), get_irg_dump_name(env->irg));
        }
 }
 
-static void collect_spill(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent) {
+static
+void collect_spill(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent) {
        ir_entity *spillent = arch_get_frame_entity(env->arch_env, node);
-       check_entity(env, node, spillent);
+       be_check_entity(env, node, spillent);
        get_spill(env, node, ent);
 
        if(spillent != ent) {
@@ -398,7 +427,7 @@ static void collect_memperm(be_verify_spillslots_env_t *env, ir_node *node, ir_n
        out = get_Proj_proj(node);
 
        spillent = be_get_MemPerm_out_entity(memperm, out);
-       check_entity(env, memperm, spillent);
+       be_check_entity(env, memperm, spillent);
        if(spillent != ent) {
                ir_fprintf(stderr, "Verify warning: MemPerm %+F has different entity than reload %+F in block %+F(%s)\n",
                        node, reload, get_nodes_block(node), get_irg_dump_name(env->irg));
@@ -485,7 +514,7 @@ static void collect_spills_walker(ir_node *node, void *data) {
                        return;
                }
                ent = arch_get_frame_entity(env->arch_env, node);
-               check_entity(env, node, ent);
+               be_check_entity(env, node, ent);
 
                collect(env, spill, node, ent);
                ARR_APP1(ir_node*, env->reloads, node);
@@ -530,7 +559,7 @@ static void check_lonely_spills(ir_node *node, void *data) {
                spill_t *spill = find_spill(env, node);
                if(be_is_Spill(node)) {
                        ir_entity *ent = arch_get_frame_entity(env->arch_env, node);
-                       check_entity(env, node, ent);
+                       be_check_entity(env, node, ent);
                }
 
                if(spill == NULL) {