#include "config.h"
#endif
-#ifdef WIN32
-#include <malloc.h>
-#else
-#include <alloca.h>
+#ifdef HAVE_MALLOC_H
+ #include <malloc.h>
+#endif
+#ifdef HAVE_ALLOCA_H
+ #include <alloca.h>
#endif
#include <stdio.h>
* Environment with all the needed stuff
*/
typedef struct _be_raext_env_t {
- firm_dbg_module_t *dbg;
arch_env_t *aenv;
const arch_register_class_t *cls;
ir_graph *irg;
set *vars; /**< contains all var_info_t */
int n_cls_vars; /**< length of the array cls_vars */
var_info_t **cls_vars; /**< only the var_infos for current cls. needed for double iterating */
+ DEBUG_ONLY(firm_dbg_module_t *dbg;)
} be_raext_env_t;
if (!is_Phi(phi))
break;
- if (arch_irn_is_ignore(raenv->aenv, phi))
+ if (arch_irn_is(raenv->aenv, phi, ignore))
continue;
raenv->cls = arch_get_irn_reg_class(raenv->aenv, phi, -1);
int count = 0;
var_info_t *vi;
- raenv->cls_vars = malloc(set_count(raenv->vars) * sizeof(*raenv->cls_vars));
+ raenv->cls_vars = xmalloc(set_count(raenv->vars) * sizeof(*raenv->cls_vars));
assert(raenv->cls_vars);
set_foreach(raenv->vars, vi)
int c_spills=0, c_reloads=0;
pset_foreach(vi->values, irn) {
- if (arch_irn_is_ignore(raenv->aenv, irn) || be_is_Reload(irn)) {
+ if (arch_irn_is(raenv->aenv, irn, ignore) || be_is_Reload(irn)) {
pset_break(vi->values);
return UNSPILLABLE;
}
int pos, max;
var_info_t *vi1, *vi2;
- if (arch_get_irn_reg_class(raenv->aenv, irn, -1) != raenv->cls || arch_irn_is_ignore(raenv->aenv, irn))
+ if (arch_get_irn_reg_class(raenv->aenv, irn, -1) != raenv->cls || arch_irn_is(raenv->aenv, irn, ignore))
return;
vi1 = get_var_info(irn);
/* copies have affinities */
if (arch_irn_classify(raenv->aenv, irn) == arch_irn_class_copy) {
- ir_node *other = get_irn_n(irn, be_pos_Copy_orig);
+ ir_node *other = be_get_Copy_op(irn);
- if (! arch_irn_is_ignore(raenv->aenv, other)) {
+ if (! arch_irn_is(raenv->aenv, other, ignore)) {
vi2 = get_var_info(other);
fprintf(raenv->f, "(%d, %d, %d)\n", vi1->var_nr, vi2->var_nr, get_affinity_weight(irn));
for (pos = 0, max = get_irn_arity(irn); pos<max; ++pos) {
arch_get_register_req(raenv->aenv, &req, irn, pos);
- if (arch_register_req_is(&req, should_be_same) && arch_irn_is_ignore(raenv->aenv, req.other_same)) {
+ if (arch_register_req_is(&req, should_be_same) && arch_irn_is(raenv->aenv, req.other_same, ignore)) {
vi2 = get_var_info(req.other_same);
fprintf(raenv->f, "(%d, %d, %d)\n", vi1->var_nr, vi2->var_nr, get_affinity_weight(irn));
raenv.aenv = env->arch_env;
raenv.dom_info = be_compute_dominance_frontiers(irg);
raenv.vars = new_set(compare_var_infos, 64);
- raenv.dbg = firm_dbg_register("ir.be.raextern");
- firm_dbg_set_mask(raenv.dbg, DBG_LEVEL);
+ FIRM_DBG_REGISTER(raenv.dbg, "firm.be.raextern");
/* Insert copies for constraints */
handle_constraints(&raenv);