-#include "basic-block.h"
-#include "ssa.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "output.h"
-
-\f
-/* A map from blocks to the edges on which they are control dependent. */
-typedef struct {
- /* An dynamically allocated array. The Nth element corresponds to
- the block with index N + 2. The Ith bit in the bitmap is set if
- that block is dependent on the Ith edge. */
- bitmap *data;
- /* The number of elements in the array. */
- int length;
-} control_dependent_block_to_edge_map_s, *control_dependent_block_to_edge_map;
-
-/* Local function prototypes. */
-static control_dependent_block_to_edge_map control_dependent_block_to_edge_map_create
- PARAMS((size_t num_basic_blocks));
-static void set_control_dependent_block_to_edge_map_bit
- PARAMS ((control_dependent_block_to_edge_map c, basic_block bb,
- int edge_index));
-static void control_dependent_block_to_edge_map_free
- PARAMS ((control_dependent_block_to_edge_map c));
-static void find_all_control_dependences
- PARAMS ((struct edge_list *el, int *pdom,
- control_dependent_block_to_edge_map cdbte));
-static void find_control_dependence
- PARAMS ((struct edge_list *el, int edge_index, int *pdom,
- control_dependent_block_to_edge_map cdbte));
-static basic_block find_pdom
- PARAMS ((int *pdom, basic_block block));
-static int inherently_necessary_register_1
- PARAMS ((rtx *current_rtx, void *data));
-static int inherently_necessary_register
- PARAMS ((rtx current_rtx));
-static int find_inherently_necessary
- PARAMS ((rtx current_rtx));
-static int propagate_necessity_through_operand
- PARAMS ((rtx *current_rtx, void *data));
-\f
-/* Unnecessary insns are indicated using insns' in_struct bit. */
-
-/* Indicate INSN is dead-code; returns nothing. */
-#define KILL_INSN(INSN) INSN_DEAD_CODE_P(INSN) = 1
-/* Indicate INSN is necessary, i.e., not dead-code; returns nothing. */
-#define RESURRECT_INSN(INSN) INSN_DEAD_CODE_P(INSN) = 0
-/* Return nonzero if INSN is unnecessary. */
-#define UNNECESSARY_P(INSN) INSN_DEAD_CODE_P(INSN)
-static void mark_all_insn_unnecessary
- PARAMS ((void));
-/* Execute CODE with free variable INSN for all unnecessary insns in
- an unspecified order, producing no output. */
-#define EXECUTE_IF_UNNECESSARY(INSN, CODE) \
-{ \
- rtx INSN; \
- \
- for (INSN = get_insns (); INSN != NULL_RTX; INSN = NEXT_INSN (INSN)) \
- if (INSN_DEAD_CODE_P (INSN)) { \
- CODE; \
- } \
-}
-/* Find the label beginning block BB. */
-static rtx find_block_label
- PARAMS ((basic_block bb));
-/* Remove INSN, updating its basic block structure. */
-static void delete_insn_bb
- PARAMS ((rtx insn));
-\f
-/* Recording which blocks are control dependent on which edges. We
- expect each block to be control dependent on very few edges so we
- use a bitmap for each block recording its edges. An array holds
- the bitmap. Its position 0 entry holds the bitmap for block
- INVALID_BLOCK+1 so that all blocks, including the entry and exit
- blocks can participate in the data structure. */
-
-/* Create a control_dependent_block_to_edge_map, given the number
- NUM_BASIC_BLOCKS of non-entry, non-exit basic blocks, e.g.,
- n_basic_blocks. This memory must be released using
- control_dependent_block_to_edge_map_free (). */
-
-static control_dependent_block_to_edge_map
-control_dependent_block_to_edge_map_create (num_basic_blocks)
- size_t num_basic_blocks;
+#include "flags.h"
+#include "except.h"
+#include "df.h"
+#include "cselib.h"
+#include "dce.h"
+#include "timevar.h"
+#include "tree-pass.h"
+#include "dbgcnt.h"
+#include "tm_p.h"
+
+
+/* -------------------------------------------------------------------------
+ Core mark/delete routines
+ ------------------------------------------------------------------------- */
+
+/* True if we are invoked while the df engine is running; in this case,
+ we don't want to reenter it. */
+static bool df_in_progress = false;
+
+/* Instructions that have been marked but whose dependencies have not
+ yet been processed. */
+static VEC(rtx,heap) *worklist;
+
+/* Bitmap of instructions marked as needed indexed by INSN_UID. */
+static sbitmap marked;
+
+/* Bitmap obstacks used for block processing by the fast algorithm. */
+static bitmap_obstack dce_blocks_bitmap_obstack;
+static bitmap_obstack dce_tmp_bitmap_obstack;
+
+static bool find_call_stack_args (rtx, bool, bool, bitmap);
+
+/* A subroutine for which BODY is part of the instruction being tested;
+ either the top-level pattern, or an element of a PARALLEL. The
+ instruction is known not to be a bare USE or CLOBBER. */
+
+static bool
+deletable_insn_p_1 (rtx body)