Commit cf930869 authored by Michael Beck's avatar Michael Beck
Browse files

add config.h to allow Win32 compile

add missing #endif
cleaned up pnc handling

[r8202]
parent ac1022e7
#include <assert.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <assert.h>
#include "array.h"
#include "debug.h"
#include "ircons.h"
......@@ -9,6 +19,9 @@
DEBUG_ONLY(static firm_dbg_module_t *dbg);
/**
* Block-walker:
*/
static void cond_eval(ir_node* block, void* env)
{
int n_block = get_Block_n_cfgpreds(block);
......@@ -73,6 +86,7 @@ static void cond_eval(ir_node* block, void* env)
tarval* tv_cnst;
ir_node** ins;
int k;
pn_Cmp cmp_val;
pred = get_Phi_pred(phi, j);
// TODO handle Phi cascades
......@@ -81,33 +95,11 @@ static void cond_eval(ir_node* block, void* env)
tv_phi = get_Const_tarval(pred);
tv_cnst = get_Const_tarval(cnst);
switch (tarval_cmp(tv_phi, tv_cnst)) {
case pn_Cmp_Lt:
if (pnc != pn_Cmp_Lt &&
pnc != pn_Cmp_Le &&
pnc != pn_Cmp_Lg) {
cmp_val = tarval_cmp(tv_phi, tv_cnst);
if (cmp_val == pn_Cmp_False)
continue;
}
break;
case pn_Cmp_Eq:
if (pnc != pn_Cmp_Le &&
pnc != pn_Cmp_Ge &&
pnc != pn_Cmp_Eq) {
continue;
}
break;
case pn_Cmp_Gt:
if (pnc != pn_Cmp_Gt &&
pnc != pn_Cmp_Ge &&
pnc != pn_Cmp_Lg) {
if ((cmp_val & pnc) != cmp_val)
continue;
}
break;
default: continue;
}
DB((
dbg, LEVEL_1,
......@@ -132,6 +124,7 @@ static void cond_eval(ir_node* block, void* env)
void opt_cond_eval(ir_graph* irg)
{
FIRM_DBG_REGISTER(dbg, "firm.opt.condeval");
firm_dbg_set_mask(dbg, SET_LEVEL_5);
DB((dbg, LEVEL_1, "===> Performing condition evaluation on %+F\n", irg));
......
......@@ -2,3 +2,5 @@
#define FIRM_COND_EVAL_H
void opt_cond_eval(ir_graph* irg);
#endif /* FIRM_COND_EVAL_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment