]> granicus.if.org Git - php/commitdiff
Expose zend_ssa_is_no_val_use()
authorDmitry Stogov <dmitry@zend.com>
Mon, 3 Apr 2017 13:57:29 +0000 (16:57 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 3 Apr 2017 13:57:29 +0000 (16:57 +0300)
ext/opcache/Optimizer/zend_inference.c
ext/opcache/Optimizer/zend_ssa.h

index 9472f00f93e50f86f3eb5d797d872dedfc3e5fbf..b3ec0c7a2ac55375085cee71bde688331d4288f8 100644 (file)
@@ -241,21 +241,6 @@ int zend_ssa_find_sccs(const zend_op_array *op_array, zend_ssa *ssa) /* {{{ */
 }
 /* }}} */
 
-static inline zend_bool is_no_val_use(const zend_op *opline, const zend_ssa_op *ssa_op, int var)
-{
-       if (opline->opcode == ZEND_ASSIGN ||
-                       (opline->opcode == ZEND_UNSET_VAR && (opline->extended_value & ZEND_QUICK_SET))) {
-               return ssa_op->op1_use == var && ssa_op->op2_use != var;
-       }
-       if (opline->opcode == ZEND_FE_FETCH_R) {
-               return ssa_op->op2_use == var && ssa_op->op1_use != var;
-       }
-       if (ssa_op->result_use == var && opline->opcode != ZEND_ADD_ARRAY_ELEMENT) {
-               return 1;
-       }
-       return 0;
-}
-
 int zend_ssa_find_false_dependencies(const zend_op_array *op_array, zend_ssa *ssa) /* {{{ */
 {
        zend_ssa_var *ssa_vars = ssa->vars;
@@ -277,7 +262,7 @@ int zend_ssa_find_false_dependencies(const zend_op_array *op_array, zend_ssa *ss
                ssa_vars[i].no_val = 1; /* mark as unused */
                use = ssa->vars[i].use_chain;
                while (use >= 0) {
-                       if (!is_no_val_use(&op_array->opcodes[use], &ssa->ops[use], i)) {
+                       if (!zend_ssa_is_no_val_use(&op_array->opcodes[use], &ssa->ops[use], i)) {
                                ssa_vars[i].no_val = 0; /* used directly */
                                zend_bitset_incl(worklist, i);
                                break;
@@ -3395,7 +3380,7 @@ static zend_bool can_convert_to_double(
                zend_op *opline = &op_array->opcodes[use];
                zend_ssa_op *ssa_op = &ssa->ops[use];
 
-               if (is_no_val_use(opline, ssa_op, var_num)) {
+               if (zend_ssa_is_no_val_use(opline, ssa_op, var_num)) {
                        continue;
                }
 
index 5e03f8ba6986ae3333af58604e3539469031b038..1130d9d62a6bddd55cda78a69edbb9bf03843c4a 100644 (file)
@@ -157,6 +157,21 @@ static zend_always_inline zend_ssa_phi* zend_ssa_next_use_phi(const zend_ssa *ss
        return NULL;
 }
 
+static zend_always_inline zend_bool zend_ssa_is_no_val_use(const zend_op *opline, const zend_ssa_op *ssa_op, int var)
+{
+       if (opline->opcode == ZEND_ASSIGN ||
+                       (opline->opcode == ZEND_UNSET_VAR && (opline->extended_value & ZEND_QUICK_SET))) {
+               return ssa_op->op1_use == var && ssa_op->op2_use != var;
+       }
+       if (opline->opcode == ZEND_FE_FETCH_R) {
+               return ssa_op->op2_use == var && ssa_op->op1_use != var;
+       }
+       if (ssa_op->result_use == var && opline->opcode != ZEND_ADD_ARRAY_ELEMENT) {
+               return 1;
+       }
+       return 0;
+}
+
 #endif /* ZEND_SSA_H */
 
 /*