-
- /* reduce for support function calls */
- if (ic->supportRtn || ic->op == '+' || ic->op == '-' )
- packRegsForSupport (ic,ebp);
-
- /* some cases the redundant moves can
- can be eliminated for return statements */
- if ((ic->op == RETURN || ic->op == SEND) &&
- !isOperandInFarSpace(IC_LEFT(ic)) &&
- !options.model)
- packRegsForOneuse (ic,IC_LEFT(ic),ebp);
-
- /* if pointer set & left has a size more than
- one and right is not in far space */
- if (POINTER_SET(ic) &&
- !isOperandInFarSpace(IC_RIGHT(ic)) &&
- !OP_SYMBOL(IC_RESULT(ic))->remat &&
- !IS_OP_RUONLY(IC_RIGHT(ic)) &&
- getSize(aggrToPtr(operandType(IC_RESULT(ic)),FALSE)) > 1 )
-
- packRegsForOneuse (ic,IC_RESULT(ic),ebp);
-
- /* if pointer get */
- if (POINTER_GET(ic) &&
- !isOperandInFarSpace(IC_RESULT(ic))&&
- !OP_SYMBOL(IC_LEFT(ic))->remat &&
- !IS_OP_RUONLY(IC_RESULT(ic)) &&
- getSize(aggrToPtr(operandType(IC_LEFT(ic)),FALSE)) > 1 )
-
- packRegsForOneuse (ic,IC_LEFT(ic),ebp);
-
-
- /* if this is cast for intergral promotion then
- check if only use of the definition of the
- operand being casted/ if yes then replace
- the result of that arithmetic operation with
- this result and get rid of the cast */
- if (ic->op == CAST) {
- link *fromType = operandType(IC_RIGHT(ic));
- link *toType = operandType(IC_LEFT(ic));
-
- if (IS_INTEGRAL(fromType) && IS_INTEGRAL(toType) &&
- getSize(fromType) != getSize(toType) ) {
-
- iCode *dic = packRegsForOneuse(ic,IC_RIGHT(ic),ebp);
- if (dic) {
- if (IS_ARITHMETIC_OP(dic)) {
- IC_RESULT(dic) = IC_RESULT(ic);
- remiCodeFromeBBlock(ebp,ic);
- hTabDeleteItem (&iCodehTab,ic->key,ic,DELETE_ITEM,NULL);
- OP_DEFS(IC_RESULT(dic)) = bitVectSetBit(OP_DEFS(IC_RESULT(dic)),dic->key);
- ic = ic->prev;
- } else
- OP_SYMBOL(IC_RIGHT(ic))->ruonly = 0;
- }
- } else {
-
- /* if the type from and type to are the same
- then if this is the only use then packit */
- if (checkType(operandType(IC_RIGHT(ic)),
- operandType(IC_LEFT(ic))) == 1) {
- iCode *dic = packRegsForOneuse (ic,IC_RIGHT(ic),ebp);
- if (dic) {
- IC_RESULT(dic) = IC_RESULT(ic);
- remiCodeFromeBBlock(ebp,ic);
- hTabDeleteItem (&iCodehTab,ic->key,ic,DELETE_ITEM,NULL);
- OP_DEFS(IC_RESULT(dic)) = bitVectSetBit(OP_DEFS(IC_RESULT(dic)),dic->key);
- ic = ic->prev;
+
+ /* reduce for support function calls */
+ if (ic->supportRtn || ic->op == '+' || ic->op == '-')
+ packRegsForSupport (ic, ebp);
+
+ /* some cases the redundant moves can
+ can be eliminated for return statements */
+ if ((ic->op == RETURN || (ic->op == SEND && ic->argreg == 1)) &&
+ !isOperandInFarSpace (IC_LEFT (ic)) &&
+ options.model == MODEL_SMALL) {
+ packRegsForOneuse (ic, IC_LEFT (ic), ebp);
+ }
+
+ /* if pointer set & left has a size more than
+ one and right is not in far space */
+ if (POINTER_SET (ic) &&
+ !isOperandInFarSpace (IC_RIGHT (ic)) &&
+ !OP_SYMBOL (IC_RESULT (ic))->remat &&
+ !IS_OP_RUONLY (IC_RIGHT (ic)) &&
+ getSize (aggrToPtr (operandType (IC_RESULT (ic)), FALSE)) > 1)
+ packRegsForOneuse (ic, IC_RESULT (ic), ebp);
+
+ /* if pointer get */
+ if (POINTER_GET (ic) &&
+ !isOperandInFarSpace (IC_RESULT (ic)) &&
+ !OP_SYMBOL (IC_LEFT (ic))->remat &&
+ !IS_OP_RUONLY (IC_RESULT (ic)) &&
+ getSize (aggrToPtr (operandType (IC_LEFT (ic)), FALSE)) > 1)
+ packRegsForOneuse (ic, IC_LEFT (ic), ebp);
+
+
+ /* if this is cast for intergral promotion then
+ check if only use of the definition of the
+ operand being casted/ if yes then replace
+ the result of that arithmetic operation with
+ this result and get rid of the cast */
+ if (ic->op == CAST)
+ {
+ sym_link *fromType = operandType (IC_RIGHT (ic));
+ sym_link *toType = operandType (IC_LEFT (ic));
+
+ if (IS_INTEGRAL (fromType) && IS_INTEGRAL (toType) &&
+ getSize (fromType) != getSize (toType) &&
+ SPEC_USIGN (fromType) == SPEC_USIGN (toType))
+ {
+
+ iCode *dic = packRegsForOneuse (ic, IC_RIGHT (ic), ebp);
+ if (dic)
+ {
+ if (IS_ARITHMETIC_OP (dic))
+ {
+ bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
+ ReplaceOpWithCheaperOp(&IC_RESULT (dic), IC_RESULT (ic));
+ remiCodeFromeBBlock (ebp, ic);
+ bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
+ hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
+ OP_DEFS_SET ((IC_RESULT (dic)), bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key));
+ ic = ic->prev;
+ }
+ else
+ OP_SYMBOL (IC_RIGHT (ic))->ruonly = 0;
+ }
+ }
+ else
+ {
+
+ /* if the type from and type to are the same
+ then if this is the only use then packit */
+ if (compareType (operandType (IC_RIGHT (ic)),
+ operandType (IC_LEFT (ic))) == 1)
+ {
+ iCode *dic = packRegsForOneuse (ic, IC_RIGHT (ic), ebp);
+ if (dic)
+ {
+ bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
+ ReplaceOpWithCheaperOp(&IC_RESULT (dic), IC_RESULT (ic));
+ remiCodeFromeBBlock (ebp, ic);
+ bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
+ hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
+ OP_DEFS_SET ((IC_RESULT (dic)), bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key));
+ ic = ic->prev;