]> granicus.if.org Git - yasm/commitdiff
Support optimization of multiple.
authorPeter Johnson <peter@tortall.net>
Wed, 21 Jun 2006 06:25:52 +0000 (06:25 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 21 Jun 2006 06:25:52 +0000 (06:25 -0000)
svn path=/branches/new-optimizer/; revision=1589

libyasm/bytecode.c
libyasm/section.c

index 52c039cd833ac54db2340ea60b5ee4e6c4221c5b..7bcafcc21d0e576bd0aa32f3d2e5f18bf4e1afad 100644 (file)
@@ -248,8 +248,11 @@ yasm_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val,
               /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres)
 {
     if (span == 0) {
-       yasm_internal_error(N_("cannot expand multiple yet"));
-
+       if (new_val < 0) {
+           yasm_error_set(YASM_ERROR_VALUE, N_("multiple is negative"));
+           return -1;
+       }
+       bc->mult_int = (unsigned long)new_val;
        return 1;
     }
     if (!bc->callback) {
index 40fbad38832ee4ee056b74d9543e03c89d318b69..531b1fee34f7d644eb3e58b695578d29ccaf407e 100644 (file)
@@ -1028,14 +1028,10 @@ optimize_term_expand(IntervalTreeNode *node, void *d)
        return; /* didn't exceed thresholds, we're done */
 
     /* Exceeded thresholds, need to add to Q for expansion */
-    switch (span->special) {
-       case NOT_SPECIAL:
-           STAILQ_INSERT_TAIL(&optd->QB, span, linkq);
-           break;
-       case SPECIAL_BC_OFFSET:
-           STAILQ_INSERT_TAIL(&optd->QA, span, linkq);
-           break;
-    }
+    if (span->special == SPECIAL_BC_OFFSET || span->id == 0)
+       STAILQ_INSERT_TAIL(&optd->QA, span, linkq);
+    else
+       STAILQ_INSERT_TAIL(&optd->QB, span, linkq);
     span->active = 2;      /* Mark as being in Q */
 }