-
- /* we will eliminate certain special case situations*/
- /* of the conditional statement :- */
- /* if cond != 0 goto _trueLabel */
- /* goto _falseLabel */
- /* _trueLabel : */
- /* ... */
- /* in these cases , if this is the only reference */
- /* to the _trueLabel, we can change it to :- */
- /* if cond == 0 goto _falseLabel */
- /* ... */
- /* similarly if we have a situation like :- */
- /* if cond == 0 goto _falseLabel */
- /* goto _someLabel */
- /* _falseLabel : */
- /* we can change this to */
- /* if cond != 0 goto _someLabel */
- /* ... */
- if (loop->op == IFX &&
- loop->next &&
- loop->next->op == GOTO &&
- loop->next->next &&
- loop->next->next->op == LABEL ) {
-
-
- /* now check that the last label is the */
- /* same as the _trueLabel of this */
- if (IC_TRUE(loop))
- if ( (IC_TRUE(loop))->key != (IC_LABEL(loop->next->next))->key )
- continue ;
- else ;
- else
- if ( (IC_FALSE(loop))->key != (IC_LABEL(loop->next->next))->key )
- continue;
-
- /* now make sure that this is the only */
- /* referenece to the _trueLabel */
- if ( IC_TRUE(loop) && hTabItemWithKey(labelRef,(IC_TRUE(loop))->key) ) {
-
- /* we just change the falseLabel */
- /* to the next goto statement */
- /* unreferenced label will take */
- /* care of removing the label */
- /* delete reference to the true label */
-
- hTabDeleteItem(&labelRef, (IC_TRUE(loop))->key, loop, DELETE_ITEM,NULL);
- IC_TRUE(loop) = NULL ;
- IC_FALSE(loop) = IC_LABEL(loop->next);
- /* add reference to the LABEL */
- hTabAddItem (&labelRef,(IC_FALSE(loop))->key,loop);
- /* next remove the goto */
- hTabDeleteItem(&labelRef,
- (IC_LABEL(loop->next))->key,loop->next,DELETE_ITEM,NULL);
- loop->next = loop->next->next ;
- loop->next->prev = loop ;
- change++;
- continue ;
+
+ /* we will eliminate certain special case situations */
+ /* of the conditional statement :- */
+ /* if cond != 0 goto _trueLabel */
+ /* goto _falseLabel */
+ /* _trueLabel : */
+ /* ... */
+ /* in these cases , if this is the only reference */
+ /* to the _trueLabel, we can change it to :- */
+ /* if cond == 0 goto _falseLabel */
+ /* ... */
+ /* similarly if we have a situation like :- */
+ /* if cond == 0 goto _falseLabel */
+ /* goto _someLabel */
+ /* _falseLabel : */
+ /* we can change this to */
+ /* if cond != 0 goto _someLabel */
+ /* ... */
+ if (loop->op == IFX &&
+ loop->next &&
+ loop->next->op == GOTO &&
+ loop->next->next &&
+ loop->next->next->op == LABEL)
+ {
+
+
+ /* now check that the last label is the */
+ /* same as the _trueLabel of this */
+ if (IC_TRUE (loop))
+ if ((IC_TRUE (loop))->key != (IC_LABEL (loop->next->next))->key)
+ continue;
+ else;
+ else if ((IC_FALSE (loop))->key != (IC_LABEL (loop->next->next))->key)
+ continue;
+
+ /* now make sure that this is the only */
+ /* referenece to the _trueLabel */
+ if (IC_TRUE (loop) && hTabItemWithKey (labelRef, (IC_TRUE (loop))->key))
+ {
+
+ /* we just change the falseLabel */
+ /* to the next goto statement */
+ /* unreferenced label will take */
+ /* care of removing the label */
+ /* delete reference to the true label */
+
+ hTabDeleteItem (&labelRef, (IC_TRUE (loop))->key, loop, DELETE_ITEM, NULL);
+ IC_TRUE (loop) = NULL;
+ IC_FALSE (loop) = IC_LABEL (loop->next);
+ /* add reference to the LABEL */
+ hTabAddItem (&labelRef, (IC_FALSE (loop))->key, loop);
+ /* next remove the goto */
+ hTabDeleteItem (&labelRef,
+ (IC_LABEL (loop->next))->key, loop->next, DELETE_ITEM, NULL);
+ loop->next = loop->next->next;
+ loop->next->prev = loop;
+ change++;
+ continue;
+ }
+
+ /* now do the same with the false labels */
+ if (IC_FALSE (loop) &&
+ hTabItemWithKey (labelRef, (IC_FALSE (loop))->key))
+ {
+
+ hTabDeleteItem (&labelRef, (IC_FALSE (loop))->key, loop, DELETE_ITEM, NULL);
+ IC_FALSE (loop) = NULL;
+ IC_TRUE (loop) = IC_LABEL (loop->next);
+ hTabAddItem (&labelRef, (IC_TRUE (loop))->key, loop);
+ hTabDeleteItem (&labelRef, (IC_LABEL (loop->next))->key, loop->next, DELETE_ITEM, NULL);
+ loop->next = loop->next->next;
+ loop->next->prev = loop;
+ change++;
+ continue;