#include "beverify.h"
#include "belive.h"
-#include "besched.h"
+#include "besched_t.h"
#include "irnode.h"
#include "irgraph.h"
#include "irgwalk.h"
#include "irprintf.h"
#include "irdump_t.h"
+#include "benode_t.h"
typedef struct be_verify_register_pressure_env_t_ {
ir_graph *irg; /**< the irg to verify */
+ be_lv_t *lv; /**< Liveness information. */
const arch_env_t *arch_env; /**< an architecture environment */
const arch_register_class_t *cls; /**< the register class to check for */
int registers_available; /**< number of available registers */
int pressure;
/* collect register pressure info, start with end of a block */
- be_liveness_end_of_block(env->arch_env, env->cls, block, live_nodes);
+ be_liveness_end_of_block(env->lv, env->arch_env, env->cls, block, live_nodes);
pressure = pset_count(live_nodes);
if(pressure > env->registers_available) {
{
be_verify_register_pressure_env_t env;
- be_liveness(irg);
-
+ env.lv = be_liveness(irg);
env.irg = irg;
env.arch_env = arch_env;
env.cls = cls;
env.problem_found = 0;
irg_block_walk_graph(irg, verify_liveness_walker, NULL, &env);
+ be_liveness_free(env.lv);
return ! env.problem_found;
}
}
cfchange_found = 1;
} else if (cfchange_found) {
- /* check for delay branches */
- if (delay_branches == 0) {
- ir_fprintf(stderr, "Verify Warning: Node %+F scheduled after control flow changing node (+delay branches) in block %+F (%s)\n",
- node, block, get_irg_dump_name(env->irg));
- env->problem_found = 1;
- } else {
- delay_branches--;
+ // proj and keepany aren't real instructions...
+ if(!is_Proj(node) && !be_is_Keep(node)) {
+ /* check for delay branches */
+ if (delay_branches == 0) {
+ ir_fprintf(stderr, "Verify Warning: Node %+F scheduled after control flow changing node (+delay branches) in block %+F (%s)\n",
+ node, block, get_irg_dump_name(env->irg));
+ env->problem_found = 1;
+ } else {
+ delay_branches--;
+ }
}
}
node, block, get_irg_dump_name(env->irg));
env->problem_found = 1;
}
- for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
- pset_insert_ptr(uses, get_irn_n(node, i));
+ if(!is_Phi(node)) {
+ for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
+ pset_insert_ptr(uses, get_irn_n(node, i));
+ }
}
}
del_pset(uses);
return ! env.problem_found;
}
+
+/* Ideas for further verifiers:
+ * - make sure that each use is dominated by its definition (except phi arguments)
+ * - make sure that all spills attached to phims spill into the same slot...
+ */