isinSet (ebb->succList, eBBWithEntryLabel (ebbs, label, count)))
{
- remiCodeFromeBBlock (ebb, ic);
- computeControlFlow (ebbs, count, 1);
if (!options.lessPedantic) {
werror (W_CONTROL_FLOW, ic->filename, ic->lineno);
}
- return;
+ if (IS_OP_VOLATILE (IC_COND (ic)))
+ {
+ IC_RIGHT (ic) = IC_COND (ic);
+ IC_LEFT (ic) = NULL;
+ IC_RESULT (ic) = NULL;
+ ic->op = DUMMY_READ_VOLATILE;
+ }
+ else
+ {
+ remiCodeFromeBBlock (ebb, ic);
+ computeControlFlow (ebbs, count, 1);
+ return;
+ }
}
/* if it remains an IFX the update the use Set */
- OP_USES(IC_COND (ic))=bitVectSetBit (OP_USES (IC_COND (ic)), ic->key);
- setUsesDefs (IC_COND (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
+ if (ic->op == IFX)
+ {
+ OP_USES(IC_COND (ic))=bitVectSetBit (OP_USES (IC_COND (ic)), ic->key);
+ setUsesDefs (IC_COND (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
+ }
+ else if (ic->op == DUMMY_READ_VOLATILE)
+ {
+ OP_USES(IC_RIGHT (ic))=bitVectSetBit (OP_USES (IC_RIGHT (ic)), ic->key);
+ setUsesDefs (IC_RIGHT (ic), ebb->defSet, ebb->outDefs, &ebb->usesDefs);
+ }
return;
}
return change;
}
+/*-------------------------------------------------------------------*/
+/* deleteIfx - delete an IFX iCode or convert to DUMMY_READ_VOLATILE */
+/*-------------------------------------------------------------------*/
+static void
+deleteIfx (iCode * loop, int key)
+{
+ if (!options.lessPedantic)
+ {
+ werror (W_CONTROL_FLOW, loop->filename, loop->lineno);
+ }
+ hTabDeleteItem (&labelRef, key, loop, DELETE_ITEM, NULL);
+
+ /* If the condition was volatile, convert IFX to */
+ /* DUMMY_READ_VOLATILE. Otherwise just delete the */
+ /* IFX iCode */
+ if (IS_OP_VOLATILE (IC_COND (loop)))
+ {
+ IC_RIGHT (loop) = IC_COND (loop);
+ IC_LEFT (loop) = NULL;
+ IC_RESULT (loop) = NULL;
+ loop->op = DUMMY_READ_VOLATILE;
+ }
+ else
+ {
+ loop->prev->next = loop->next;
+ loop->next->prev = loop->prev;
+ }
+}
+
+
/*-----------------------------------------------------------------*/
/* labelIfx - special case Ifx elimination */
/*-----------------------------------------------------------------*/
if (IC_TRUE (loop) &&
IC_TRUE (loop)->key == IC_LABEL (loop->next)->key)
{
-
- /* get rid of this if */
- if (!options.lessPedantic) {
- werror (W_CONTROL_FLOW, loop->filename, loop->lineno);
- }
- loop->prev->next = loop->next;
- loop->next->prev = loop->prev;
- hTabDeleteItem (&labelRef,
- (IC_TRUE (loop))->key,
- loop, DELETE_ITEM, NULL);
+ deleteIfx (loop, IC_TRUE (loop)->key);
change++;
- continue;
+ continue;
}
else
{
if (IC_FALSE (loop) &&
IC_FALSE (loop)->key == IC_LABEL (loop->next)->key)
{
- /* get rid of this if */
- if (!options.lessPedantic) {
- werror (W_CONTROL_FLOW, loop->filename, loop->lineno);
- }
- loop->prev->next = loop->next;
- loop->next->prev = loop->prev;
- hTabDeleteItem (&labelRef,
- (IC_FALSE (loop))->key,
- loop, DELETE_ITEM, NULL);
+ deleteIfx (loop, IC_FALSE (loop)->key);
change++;
continue;
}
((IC_TRUE (loop) && IC_TRUE (loop)->key == IC_LABEL (loop->next)->key) ||
(IC_FALSE (loop) && IC_FALSE (loop)->key == IC_LABEL (loop->next)->key)))
{
- if (!options.lessPedantic) {
- werror (W_CONTROL_FLOW, loop->filename, loop->lineno);
- }
- loop->prev->next = loop->next;
- loop->next->prev = loop->prev;
- hTabDeleteItem (&labelRef,
- IC_LABEL (loop->next)->key,
- loop, DELETE_ITEM, NULL);
+ deleteIfx (loop, IC_LABEL (loop->next)->key);
change++;
continue;
}
emitcode ("", "%05d$:", (tlbl->key + 100));
}
else
- werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
- "Bad rIdx in asmToBool");
- return;
+ {
+ werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
+ "Bad rIdx in asmToBool");
+ return;
+ }
+ break;
case AOP_EXT:
if (resultInA)
needpula = FALSE;
return 1;
}
+
/*------------------------------------------------------------------*/
/* findAssignToSym : scanning backwards looks for first assig found */
/*------------------------------------------------------------------*/
packRegsForSupport (iCode * ic, eBBlock * ebp)
{
iCode *dic;
+ int changes = 0;
/* for the left & right operand :- look to see if the
left was assigned a true symbol in far space in that
{
/* found it we need to remove it from the block */
reassignAliasedSym (ebp, dic, ic, IC_LEFT(ic));
- return 1;
+ changes++;
}
}
if (dic)
{
- /* if this is a subtraction & the result
- is a true symbol in far space then don't pack */
-#if 0
- if (ic->op == '-' && IS_TRUE_SYMOP (IC_RESULT (dic)))
- {
- sym_link *etype = getSpec (operandType (IC_RESULT (dic)));
- if (IN_FARSPACE (SPEC_OCLS (etype)))
- return 0;
- }
-#endif
- /* found it we need to remove it from the
- block */
+ /* found it we need to remove it from the block */
reassignAliasedSym (ebp, dic, ic, IC_RIGHT(ic));
-
- return 1;
+ changes++;
}
}
- return 0;
+ return changes;
}
#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
!IS_BITWISE_OP (uic) &&
(uic->op != LEFT_OP) &&
(uic->op != RIGHT_OP) &&
- (uic->op != GETHBIT))
+ (uic->op != GETHBIT) &&
+ (uic->op != RETURN) &&
+ (uic->op != '~') &&
+ (uic->op != '!'))
return;
#if 0
}
/* reduce for support function calls */
- if (ic->supportRtn || ic->op == '+' || ic->op == '-')
+ if (ic->supportRtn || (ic->op != IFX && ic->op != JUMPTABLE))
packRegsForSupport (ic, ebp);
#if 0
|| IS_CONDITIONAL(ic)
|| IS_BITWISE_OP (ic)
|| ic->op == '='
+ || ic->op == '!'
+ || ic->op == '~'
|| ic->op == GETHBIT
|| ic->op == LEFT_OP || ic->op == RIGHT_OP || ic->op == CALL
|| (ic->op == ADDRESS_OF && isOperandOnStack (IC_LEFT (ic)))