(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
coalesce-1.c
       1  /* { dg-do compile } */
       2  
       3  /* { dg-options "-O2 -fdump-rtl-expand-details" } */
       4  
       5  typedef long unsigned int size_t;
       6  union tree_node;
       7  typedef union tree_node *tree;
       8  union gimple_statement_d;
       9  typedef union gimple_statement_d *gimple;
      10  typedef const union tree_node *const_tree;
      11  typedef const union gimple_statement_d *const_gimple;
      12  struct gimple_seq_d;
      13  typedef struct gimple_seq_d *gimple_seq;
      14  struct edge_def;
      15  typedef struct edge_def *edge;
      16  struct basic_block_def;
      17  typedef struct basic_block_def *basic_block;
      18  typedef const struct basic_block_def *const_basic_block;
      19  struct tree_exp
      20  {
      21    tree operands[1];
      22  };
      23  typedef struct ssa_use_operand_d
      24  {
      25    tree *use;
      26  } ssa_use_operand_t;
      27  struct phi_arg_d
      28  {
      29    struct ssa_use_operand_d imm_use;
      30  };
      31  union tree_node
      32  {
      33    struct tree_exp exp;
      34  };
      35  struct function
      36  {
      37  };
      38  extern struct function *cfun;
      39  struct edge_def
      40  {
      41    unsigned int dest_idx;
      42  };
      43  static __inline__ void
      44  VEC_edge_must_be_pointer_type (void)
      45  {
      46    (void) ((edge) 1 == (void *) 1);
      47  } typedef struct VEC_edge_base
      48  
      49  {
      50    unsigned num;
      51    unsigned alloc;
      52    edge vec[1];
      53  } VEC_edge_base;
      54  typedef struct VEC_edge_none
      55  {
      56    VEC_edge_base base;
      57  } VEC_edge_none;
      58  
      59  static __inline__ edge
      60  VEC_edge_base_index (const VEC_edge_base * vec_, unsigned ix_,
      61  		     const char *file_, unsigned line_, const char *function_)
      62  {
      63    return vec_->vec[ix_];
      64  }
      65  
      66  typedef struct VEC_edge_gc
      67  {
      68    VEC_edge_base base;
      69  } VEC_edge_gc;
      70  struct basic_block_def
      71  {
      72    VEC_edge_gc *succs;
      73  };
      74  static __inline__ edge
      75  single_succ_edge (const_basic_block bb)
      76  {
      77    return (VEC_edge_base_index
      78  	  ((((bb)->succs) ? &((bb)->succs)->base : 0), (0),
      79  	   "/home/gcc/virgin-gcc/gcc/basic-block.h", 563, __FUNCTION__));
      80  }
      81  
      82  edge find_edge (basic_block, basic_block);
      83  typedef tree *def_operand_p;
      84  typedef ssa_use_operand_t *use_operand_p;
      85  struct gimple_seq_node_d;
      86  typedef struct gimple_seq_node_d *gimple_seq_node;
      87  struct gimple_seq_node_d
      88  {
      89    gimple stmt;
      90  };
      91  typedef struct
      92  {
      93    gimple_seq_node ptr;
      94    gimple_seq seq;
      95    basic_block bb;
      96  } gimple_stmt_iterator;
      97  struct gimple_statement_phi
      98  {
      99    struct phi_arg_d args[1];
     100  };
     101  union gimple_statement_d
     102  {
     103    struct gimple_statement_phi gimple_phi;
     104  };
     105  extern size_t const gimple_ops_offset_[];
     106  int gimple_statement_structure (gimple);
     107  static __inline__ tree *
     108  gimple_ops (gimple gs)
     109  {
     110    size_t off;
     111    off = gimple_ops_offset_[gimple_statement_structure (gs)];
     112    return (tree *) ((char *) gs + off);
     113  }
     114  
     115  static __inline__ tree
     116  gimple_op (const_gimple gs, unsigned i)
     117  {
     118    return gimple_ops ((((union
     119  			{
     120  			const union gimple_statement_d * _q;
     121  			union gimple_statement_d * _nq;}) (((gs))))._nq))[i];
     122  }
     123  
     124  static __inline__ struct phi_arg_d *
     125  gimple_phi_arg (gimple gs, unsigned index)
     126  {
     127    return &(gs->gimple_phi.args[index]);
     128  }
     129  
     130  static __inline__ tree
     131  gimple_switch_label (const_gimple gs, unsigned index)
     132  {
     133    return gimple_op (gs, index + 1);
     134  }
     135  
     136  gimple_stmt_iterator gsi_start_phis (basic_block);
     137  extern basic_block label_to_block_fn (struct function *, tree);
     138  
     139  static __inline__ tree
     140  get_use_from_ptr (use_operand_p use)
     141  {
     142    return *(use->use);
     143  }
     144  
     145  static __inline__ use_operand_p
     146  gimple_phi_arg_imm_use_ptr (gimple gs, int i)
     147  {
     148    return &gimple_phi_arg (gs, i)->imm_use;
     149  }
     150  
     151  struct switch_conv_info
     152  {
     153    basic_block final_bb;
     154    basic_block switch_bb;
     155    const char *reason;
     156    tree *default_values;
     157  };
     158  static struct switch_conv_info info;
     159  void gsi_next (gimple_stmt_iterator *);
     160  int gsi_gsi_start_phis (basic_block);
     161  
     162  static void
     163  gather_default_values (tree default_case)
     164  {
     165    gimple_stmt_iterator gsi;
     166    basic_block bb =
     167      (label_to_block_fn ((cfun + 0), default_case->exp.operands[2]));
     168    edge e;
     169    int i = 0;
     170    if (bb == info.final_bb)
     171      e = find_edge (info.switch_bb, bb);
     172    else
     173      e = single_succ_edge (bb);
     174    for (gsi = gsi_start_phis (info.final_bb);
     175         gsi_gsi_start_phis (info.final_bb); gsi_next (&gsi))
     176      {
     177        gimple phi = gsi.ptr->stmt;
     178        tree val = get_use_from_ptr (gimple_phi_arg_imm_use_ptr
     179  				   ((((phi))), (((e)->dest_idx))));
     180        info.default_values[i++] = val;
     181      }
     182  }
     183  
     184  unsigned int gimple_switch_num_labels (gimple);
     185  
     186  unsigned char
     187  process_switch (gimple swtch)
     188  {
     189    unsigned int i, branch_num = gimple_switch_num_labels (swtch);
     190    tree index_type;
     191    info.reason = "switch has no labels\n";
     192    gather_default_values (gimple_switch_label (swtch, 0));
     193  }
     194  
     195  /* Verify that out-of-ssa coalescing did its job by verifying there are not
     196     any partition copies inserted.  */
     197  
     198  /* { dg-final { scan-rtl-dump-not "partition copy" "expand"} } */
     199