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> #include <alloca.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <assert.h>
#include "array.h" #include "array.h"
#include "debug.h" #include "debug.h"
#include "ircons.h" #include "ircons.h"
...@@ -9,6 +19,9 @@ ...@@ -9,6 +19,9 @@
DEBUG_ONLY(static firm_dbg_module_t *dbg); DEBUG_ONLY(static firm_dbg_module_t *dbg);
/**
* Block-walker:
*/
static void cond_eval(ir_node* block, void* env) static void cond_eval(ir_node* block, void* env)
{ {
int n_block = get_Block_n_cfgpreds(block); int n_block = get_Block_n_cfgpreds(block);
...@@ -73,6 +86,7 @@ static void cond_eval(ir_node* block, void* env) ...@@ -73,6 +86,7 @@ static void cond_eval(ir_node* block, void* env)
tarval* tv_cnst; tarval* tv_cnst;
ir_node** ins; ir_node** ins;
int k; int k;
pn_Cmp cmp_val;
pred = get_Phi_pred(phi, j); pred = get_Phi_pred(phi, j);
// TODO handle Phi cascades // TODO handle Phi cascades
...@@ -81,33 +95,11 @@ static void cond_eval(ir_node* block, void* env) ...@@ -81,33 +95,11 @@ static void cond_eval(ir_node* block, void* env)
tv_phi = get_Const_tarval(pred); tv_phi = get_Const_tarval(pred);
tv_cnst = get_Const_tarval(cnst); tv_cnst = get_Const_tarval(cnst);
switch (tarval_cmp(tv_phi, tv_cnst)) { cmp_val = tarval_cmp(tv_phi, tv_cnst);
case pn_Cmp_Lt: if (cmp_val == pn_Cmp_False)
if (pnc != pn_Cmp_Lt && continue;
pnc != pn_Cmp_Le && if ((cmp_val & pnc) != cmp_val)
pnc != pn_Cmp_Lg) { continue;
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) {
continue;
}
break;
default: continue;
}
DB(( DB((
dbg, LEVEL_1, dbg, LEVEL_1,
...@@ -132,6 +124,7 @@ static void cond_eval(ir_node* block, void* env) ...@@ -132,6 +124,7 @@ static void cond_eval(ir_node* block, void* env)
void opt_cond_eval(ir_graph* irg) void opt_cond_eval(ir_graph* irg)
{ {
FIRM_DBG_REGISTER(dbg, "firm.opt.condeval"); 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)); DB((dbg, LEVEL_1, "===> Performing condition evaluation on %+F\n", irg));
......
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
#define FIRM_COND_EVAL_H #define FIRM_COND_EVAL_H
void opt_cond_eval(ir_graph* irg); 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