X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeverify.c;h=7cf226b9b8eaaab54e0e258c26961a5d422ffcbc;hb=9276447aec4972df060349e162f583c4898dfec8;hp=954fdf8c2443247bf58ae764115c17b6ed1dcde3;hpb=863d31d7a5c8210432fef88b30fc3e8353131538;p=libfirm diff --git a/ir/be/beverify.c b/ir/be/beverify.c index 954fdf8c2..7cf226b9b 100644 --- a/ir/be/beverify.c +++ b/ir/be/beverify.c @@ -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); @@ -108,10 +131,17 @@ int be_verify_register_pressure(const be_irg_t *birg, const arch_register_class_ return ! env.problem_found; } + + +//--------------------------------------------------------------------------- + + + typedef struct be_verify_schedule_env_t_ { - int problem_found; /**< flags indicating if there was a problem */ - bitset_t *scheduled; /**< bitset of scheduled nodes */ - ir_graph *irg; /**< the irg to check */ + int problem_found; /**< flags indicating if there was a problem */ + bitset_t *scheduled; /**< bitset of scheduled nodes */ + ir_graph *irg; /**< the irg to check */ + const arch_env_t *arch_env; /**< the arch_env */ } be_verify_schedule_env_t; /** @@ -225,7 +255,7 @@ static void verify_schedule_walker(ir_node *block, void *data) { } } -static int should_be_scheduled(ir_node *node) { +static int should_be_scheduled(be_verify_schedule_env_t *env, ir_node *node) { if(is_Block(node)) return -1; @@ -250,6 +280,9 @@ static int should_be_scheduled(ir_node *node) { break; } + if(arch_irn_get_flags(env->arch_env, node) & arch_irn_flags_ignore) + return -1; + return 1; } @@ -258,7 +291,7 @@ static void check_schedule(ir_node *node, void *data) { int should_be; int scheduled; - should_be = should_be_scheduled(node); + should_be = should_be_scheduled(env, node); if(should_be == -1) return; @@ -274,17 +307,18 @@ static void check_schedule(ir_node *node, void *data) { /** * Start a walk over the irg and check schedule. */ -int be_verify_schedule(ir_graph *irg) +int be_verify_schedule(const be_irg_t *birg) { be_verify_schedule_env_t env; env.problem_found = 0; - env.scheduled = bitset_alloca(get_irg_last_idx(irg)); - env.irg = irg; + env.irg = be_get_birg_irg(birg); + env.scheduled = bitset_alloca(get_irg_last_idx(env.irg)); + env.arch_env = birg->main_env->arch_env; - irg_block_walk_graph(irg, verify_schedule_walker, NULL, &env); + irg_block_walk_graph(env.irg, verify_schedule_walker, NULL, &env); // check if all nodes are scheduled - irg_walk_graph(irg, check_schedule, NULL, &env); + irg_walk_graph(env.irg, check_schedule, NULL, &env); return ! env.problem_found; }