Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/unssa.c
          +++ new/usr/src/tools/smatch/src/unssa.c
↓ open down ↓ 26 lines elided ↑ open up ↑
  27   27   * Copyright (C) 2005 Luc Van Oostenryck
  28   28   */
  29   29  
  30   30  #include "lib.h"
  31   31  #include "linearize.h"
  32   32  #include "allocate.h"
  33   33  #include "flow.h"
  34   34  #include <assert.h>
  35   35  
  36   36  
  37      -static inline int nbr_pseudo_users(pseudo_t p)
  38      -{
  39      -        return ptr_list_size((struct ptr_list *)p->users);
  40      -}
  41      -
  42   37  static int simplify_phi_node(struct instruction *phi, pseudo_t tmp)
  43   38  {
  44   39          pseudo_t target = phi->target;
  45   40          struct pseudo_user *pu;
  46   41          pseudo_t src;
  47   42  
  48   43          // verify if this phi can be simplified
  49   44          FOR_EACH_PTR(phi->phi_list, src) {
  50   45                  struct instruction *def = src->def;
  51   46  
↓ open down ↓ 36 lines elided ↑ open up ↑
  88   83  
  89   84                  assert(def->opcode == OP_PHISOURCE);
  90   85  
  91   86                  def->opcode = OP_COPY;
  92   87                  def->target = tmp;
  93   88  
  94   89                  // can we eliminate the copy?
  95   90                  src = def->phi_src;
  96   91                  if (src->type != PSEUDO_REG)
  97   92                          continue;
  98      -                switch (nbr_pseudo_users(src)) {
       93 +                switch (nbr_users(src)) {
  99   94                          struct instruction *insn;
 100   95                  case 1:
 101   96                          insn = src->def;
 102   97                          if (!insn)
 103   98                                  break;
 104   99                          insn->target = tmp;
 105  100                  case 0:
 106  101                          kill_instruction(def);
 107  102                          def->bb = NULL;
 108  103                  }
↓ open down ↓ 39 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX