From: Peter Johnson Date: Wed, 21 Jun 2006 06:25:52 +0000 (-0000) Subject: Support optimization of multiple. X-Git-Tag: v0.6.0~172^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc85eba4f5c5a216abe5f8ca1599a82a216264b7;p=yasm Support optimization of multiple. svn path=/branches/new-optimizer/; revision=1589 --- diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index 52c039cd..7bcafcc2 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -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) { diff --git a/libyasm/section.c b/libyasm/section.c index 40fbad38..531b1fee 100644 --- a/libyasm/section.c +++ b/libyasm/section.c @@ -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 */ }