]> granicus.if.org Git - yasm/commitdiff
Allow more than just times to trigger on any change during optimization;
authorPeter Johnson <peter@tortall.net>
Tue, 13 Feb 2007 07:28:53 +0000 (07:28 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 13 Feb 2007 07:28:53 +0000 (07:28 -0000)
now any negative id is treated as trigger on any change as well.

svn path=/trunk/yasm/; revision=1767

libyasm/bytecode.h
libyasm/section.c

index e26b901785dbc6eaf7917a304bdb0a31f4791d2e..96a4760bb68de4c9e32d91e4fd3a42fd9ef8f9b2 100644 (file)
@@ -310,6 +310,8 @@ unsigned long yasm_bc_next_offset(yasm_bytecode *precbc);
  * \param add_span_data        add_span_data passed into bc_calc_len()
  * \param bc           bytecode containing span
  * \param id           non-zero identifier for span; may be any non-zero value
+ *                     if <0, expand is called for any change;
+ *                     if >0, expand is only called when exceeds threshold
  * \param value                dependent value for bytecode expansion
  * \param neg_thres    negative threshold for long/short decision
  * \param pos_thres    positive threshold for long/short decision
index 7e07f4a7286c2b5b3026d1e5da9b7321d33ff9f3..a4bc1464faee6c3991aba6c5cac57e16e0bf24b6 100644 (file)
@@ -853,7 +853,7 @@ span_create_terms(yasm_span *span)
                span->items[i].data.intn = yasm_intnum_create_int(0);
 
                /* Check for circular references */
-               if (span->id == 0 &&
+               if (span->id <= 0 &&
                    ((span->bc->bc_index > span->terms[i].precbc->bc_index &&
                      span->bc->bc_index <= span->terms[i].precbc2->bc_index) ||
                     (span->bc->bc_index > span->terms[i].precbc2->bc_index &&
@@ -927,8 +927,8 @@ recalc_normal_span(yasm_span *span)
     if (span->new_val == LONG_MAX)
        span->active = 0;
 
-    /* If id=0, flag update on any change */
-    if (span->id == 0)
+    /* If id<=0, flag update on any change */
+    if (span->id <= 0)
        return (span->new_val != span->cur_val);
 
     return (span->new_val < span->neg_thres
@@ -1057,7 +1057,7 @@ check_cycle(IntervalTreeNode *node, void *d)
     int bt_size = 0, dep_bt_size = 0;
 
     /* Only check for cycles in id=0 spans */
-    if (depspan->id != 0)
+    if (depspan->id > 0)
        return;
 
     /* Check for a circular reference by looking to see if this dependent
@@ -1136,7 +1136,7 @@ optimize_term_expand(IntervalTreeNode *node, void *d)
        return; /* didn't exceed thresholds, we're done */
 
     /* Exceeded thresholds, need to add to Q for expansion */
-    if (span->id == 0)
+    if (span->id <= 0)
        STAILQ_INSERT_TAIL(&optd->QA, span, linkq);
     else
        STAILQ_INSERT_TAIL(&optd->QB, span, linkq);
@@ -1327,7 +1327,7 @@ yasm_object_optimize(yasm_object *object, yasm_arch *arch,
 
     /* Look for cycles in times expansion (span.id==0) */
     TAILQ_FOREACH(span, &optd.spans, link) {
-       if (span->id != 0)
+       if (span->id > 0)
            continue;
        optd.span = span;
        IT_enumerate(optd.itree, (long)span->bc->bc_index,