X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt_dbg.h;h=5cbdb7ec1c78c19a7fd95941e5ac520f4642917b;hb=c3c48d7bd83f042cc2951754377de928d66fe51e;hp=79e2fe0a09822d2226484b4d2a0c37bf1e66361e;hpb=23e6c4e3069989ed13163c5a9dc1da166a70a087;p=libfirm diff --git a/ir/ir/iropt_dbg.h b/ir/ir/iropt_dbg.h index 79e2fe0a0..5cbdb7ec1 100644 --- a/ir/ir/iropt_dbg.h +++ b/ir/ir/iropt_dbg.h @@ -1,89 +1,151 @@ +/* + * Project: libFIRM + * File name: ir/ir/iropt_dbg.h + * Purpose: Debug makros used in iropt. + * Author: Goetz Lindenmaier + * Modified by: + * Created: + * CVS-ID: $Id$ + * Copyright: (c) 2001-2003 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ /* This file contains makros that generate the calls to update the debug information after a transformation. */ -#define DBG_OPT_STG \ - { \ - ir_node *ons[2]; \ - ons[0] = oldn; \ - ons[1] = get_Block_cfgpred(n, 0); \ - __dbg_info_merge_sets(&n, 1, ons, 2, dbg_straightening); \ - } +#define SIZ(x) sizeof(x)/sizeof((x)[0]) + +/** + * Merge the debug info due to dead code elimination + */ +#define DBG_OPT_DEAD \ + do { \ + ir_node *ons[2]; \ + ons[0] = oldn; \ + ons[1] = get_Block_cfgpred(oldn, 0); \ + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_STG); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_dead_code); \ + } while(0) + + +/** + * Merge the debug info due to a straightening optimization + */ +#define DBG_OPT_STG \ + do { \ + ir_node *ons[2]; \ + ons[0] = oldn; \ + ons[1] = get_Block_cfgpred(oldn, 0); \ + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_STG); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_straightening); \ + } while(0) + +/** + * Merge the debug info due to an if simplification + */ #define DBG_OPT_IFSIM \ - { \ + do { \ ir_node *ons[4]; \ ons[0] = oldn; \ ons[1] = a; \ ons[2] = b; \ ons[3] = get_Proj_pred(a); \ - __dbg_info_merge_sets(&n, 1, ons, 4, dbg_if_simplification); \ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_IFSIM); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_if_simplification); \ + } while(0) + +/** + * Merge the debug info due to an algebraic_simplification + */ +#define DBG_OPT_ALGSIM0 \ + do { \ + stat_merge_nodes(&n, 1, &oldn, 1, STAT_OPT_CONST_EVAL); \ + __dbg_info_merge_pair(n, oldn, dbg_const_eval); \ + } while(0) #define DBG_OPT_ALGSIM1 \ - { \ + do { \ ir_node *ons[3]; \ ons[0] = oldn; \ ons[1] = a; \ ons[2] = b; \ - __dbg_info_merge_sets(&n, 1, ons, 3, dbg_algebraic_simplification); \ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_ALGSIM); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_algebraic_simplification); \ + } while(0) #define DBG_OPT_ALGSIM2 \ - { \ + do { \ ir_node *ons[3]; \ ons[0] = oldn; \ ons[1] = get_unop_op(n); \ - ons[2] = n; \ - __dbg_info_merge_sets(&n, 1, ons, 3, dbg_algebraic_simplification); \ - } + ons[2] = n; \ + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_ALGSIM); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_algebraic_simplification); \ + } while(0) #define DBG_OPT_ALGSIM3 \ - { \ + do { \ ir_node *ons[2]; \ ons[0] = oldn; \ ons[1] = a; \ - __dbg_info_merge_sets(&n, 1, ons, 2, dbg_algebraic_simplification); \ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_ALGSIM); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_algebraic_simplification); \ + } while(0) #define DBG_OPT_PHI \ - { \ + do { \ ir_node *ons[2]; \ ons[0] = oldn; \ ons[1] = first_val; \ - __dbg_info_merge_sets(&n, 1, ons, 2, dbg_opt_ssa); \ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_PHI); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_opt_ssa); \ + } while(0) #define DBG_OPT_WAW \ - { \ + do { \ ir_node *ons[2]; \ ons[0] = oldn; \ ons[1] = n; \ - __dbg_info_merge_sets(&n, 1, ons, 2, dbg_write_after_write);\ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_WAW); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_write_after_write);\ + } while(0) #define DBG_OPT_WAR \ - { \ + do { \ ir_node *ons[2]; \ ons[0] = oldn; \ ons[1] = c; \ - __dbg_info_merge_sets(&c, 1, ons, 2, dbg_write_after_read); \ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_WAR); \ + __dbg_info_merge_sets(&c, 1, ons, SIZ(ons), dbg_write_after_read); \ + } while(0) + +#define DBG_OPT_RAW \ + do { \ + ir_node *ons[2]; \ + ons[0] = oldn; \ + ons[1] = c; \ + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_RAW); \ + __dbg_info_merge_sets(&c, 1, ons, SIZ(ons), dbg_read_after_write); \ + } while(0) #define DBG_OPT_TUPLE \ - { \ + do { \ ir_node *ons[3]; \ ons[0] = oldn; \ ons[1] = a; \ ons[2] = n; \ - __dbg_info_merge_sets(&n, 1, ons, 3, dbg_opt_auxnode); \ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_TUPLE); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_opt_auxnode); \ + } while(0) + #define DBG_OPT_ID \ - { \ + do { \ ir_node *ons[2]; \ ons[0] = oldn; \ ons[1] = n; \ - __dbg_info_merge_sets(&n, 1, ons, 2, dbg_opt_auxnode); \ - } + stat_merge_nodes(&n, 1, ons, SIZ(ons), STAT_OPT_ID); \ + __dbg_info_merge_sets(&n, 1, ons, SIZ(ons), dbg_opt_auxnode); \ + } while(0)