/* Lower complex number operations to scalar operations.
- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "rtl.h"
-#include "real.h"
#include "flags.h"
#include "tree-flow.h"
#include "gimple.h"
#include "tree-iterator.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
-#include "diagnostic.h"
/* For each complex ssa name, a lattice value. We're interested in finding
{
tree parm, ssa_name;
- for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = TREE_CHAIN (parm))
+ for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm))
if (is_complex_reg (parm)
&& var_ann (parm) != NULL
&& (ssa_name = gimple_default_def (cfun, parm)) != NULL_TREE)
if (DECL_NAME (orig) && !DECL_IGNORED_P (orig))
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (orig));
- tree inner_type;
DECL_NAME (r) = get_identifier (ACONCAT ((name, suffix, NULL)));
- inner_type = TREE_TYPE (TREE_TYPE (orig));
SET_DECL_DEBUG_EXPR (r, build1 (code, type, orig));
DECL_DEBUG_EXPR_IS_FROM (r) = 1;
DECL_IGNORED_P (r) = 0;
case VAR_DECL:
case RESULT_DECL:
case PARM_DECL:
- case INDIRECT_REF:
case COMPONENT_REF:
case ARRAY_REF:
case VIEW_CONVERT_EXPR:
+ case MEM_REF:
{
tree inner_type = TREE_TYPE (TREE_TYPE (t));
update_complex_assignment (gimple_stmt_iterator *gsi, tree r, tree i)
{
gimple_stmt_iterator orig_si = *gsi;
+ gimple stmt;
if (gimple_in_ssa_p (cfun))
update_complex_components (gsi, gsi_stmt (*gsi), r, i);
gimple_assign_set_rhs_with_ops (&orig_si, COMPLEX_EXPR, r, i);
- update_stmt (gsi_stmt (orig_si));
+ stmt = gsi_stmt (orig_si);
+ update_stmt (stmt);
+ if (maybe_clean_eh_stmt (stmt))
+ gimple_purge_dead_eh_edges (gimple_bb (stmt));
}
edge entry_edge = single_succ_edge (ENTRY_BLOCK_PTR);
tree parm;
- for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = TREE_CHAIN (parm))
+ for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm))
{
tree type = TREE_TYPE (parm);
tree ssa_name, r, i;
{
if (is_ctrl_altering_stmt (stmt))
{
- edge_iterator ei;
edge e;
/* The value is not assigned on the exception edges, so we need not
concern ourselves there. We do need to update on the fallthru
edge. Find it. */
- FOR_EACH_EDGE (e, ei, gsi_bb (*gsi)->succs)
- if (e->flags & EDGE_FALLTHRU)
- goto found_fallthru;
- gcc_unreachable ();
- found_fallthru:
+ e = find_fallthru_edge (gsi_bb (*gsi)->succs);
+ if (!e)
+ gcc_unreachable ();
r = build1 (REALPART_EXPR, inner_type, lhs);
i = build1 (IMAGPART_EXPR, inner_type, lhs);
0, /* static_pass_number */
TV_NONE, /* tv_id */
PROP_ssa, /* properties_required */
- 0, /* properties_provided */
+ PROP_gimple_lcx, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_dump_func
- | TODO_ggc_collect
+ TODO_ggc_collect
| TODO_update_ssa
| TODO_verify_stmts /* todo_flags_finish */
}
};
\f
-/* Entry point for complex operation lowering without optimization. */
-
-static unsigned int
-tree_lower_complex_O0 (void)
-{
- int old_last_basic_block = last_basic_block;
- gimple_stmt_iterator gsi;
- basic_block bb;
-
- FOR_EACH_BB (bb)
- {
- if (bb->index >= old_last_basic_block)
- continue;
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- expand_complex_operations_1 (&gsi);
- }
- return 0;
-}
-
static bool
gate_no_optimization (void)
{
/* With errors, normal optimization passes are not run. If we don't
lower complex operations at all, rtl expansion will abort. */
- return optimize == 0 || sorrycount || errorcount;
+ return !(cfun->curr_properties & PROP_gimple_lcx);
}
struct gimple_opt_pass pass_lower_complex_O0 =
GIMPLE_PASS,
"cplxlower0", /* name */
gate_no_optimization, /* gate */
- tree_lower_complex_O0, /* execute */
+ tree_lower_complex, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_NONE, /* tv_id */
PROP_cfg, /* properties_required */
- 0, /* properties_provided */
+ PROP_gimple_lcx, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_dump_func | TODO_ggc_collect
- | TODO_verify_stmts, /* todo_flags_finish */
+ TODO_ggc_collect
+ | TODO_update_ssa
+ | TODO_verify_stmts /* todo_flags_finish */
}
};