/* This seems very dangerous to me, since there are several */
/* optimizations (for example, gcse) that don't notice the */
/* This seems very dangerous to me, since there are several */
/* optimizations (for example, gcse) that don't notice the */
/* iCode to use the original (uncasted) operand. */
/* Unfortunately, other things break when this cast is */
/* made explicit. Need to fix this someday. */
/* iCode to use the original (uncasted) operand. */
/* Unfortunately, other things break when this cast is */
/* made explicit. Need to fix this someday. */
/*-----------------------------------------------------------------*/
operand *
geniCodeBitwise (operand * left, operand * right,
/*-----------------------------------------------------------------*/
operand *
geniCodeBitwise (operand * left, operand * right,
/* geniCodeLogic- logic code */
/*-----------------------------------------------------------------*/
static operand *
/* geniCodeLogic- logic code */
/*-----------------------------------------------------------------*/
static operand *
-geniCodeLogic (operand * left, operand * right, int op)
+geniCodeLogic (operand * left, operand * right, int op, ast *tree)
ctype = usualBinaryConversions (&left, &right, RESULT_TYPE_BIT, 0);
ic = newiCode (op, left, right);
ctype = usualBinaryConversions (&left, &right, RESULT_TYPE_BIT, 0);
ic = newiCode (op, left, right);
- IC_RESULT (ic) = newiTempOperand (newCharLink (), 1);
+ /* store 0 or 1 in result */
+ ttype = (tree && IS_BIT (tree->ftype)) ? newBoolLink() : newCharLink();
+ IC_RESULT (ic) = newiTempOperand (ttype, 1);
result = newiTempOperand (type, 1);
geniCodeLabel (falseLabel);
result = newiTempOperand (type, 1);
geniCodeLabel (falseLabel);
- boundary = geniCodeLogic (cond, operandFromLit (min), '<');
+ boundary = geniCodeLogic (cond, operandFromLit (min), '<', NULL);
ic = newiCodeCondition (boundary, falseLabel, NULL);
ADDTOCHAIN (ic);
}
/* now for upper bounds */
ic = newiCodeCondition (boundary, falseLabel, NULL);
ADDTOCHAIN (ic);
}
/* now for upper bounds */
- boundary = geniCodeLogic (cond, operandFromLit (max), '>');
+ boundary = geniCodeLogic (cond, operandFromLit (max), '>', NULL);
operand *compare = geniCodeLogic (cond,
operandFromValue (caseVals),
operand *compare = geniCodeLogic (cond,
operandFromValue (caseVals),
SNPRINTF (buffer, sizeof(buffer), "_case_%d_%d",
tree->values.switchVals.swNum,
SNPRINTF (buffer, sizeof(buffer), "_case_%d_%d",
tree->values.switchVals.swNum,
leftOp = geniCodeRValue (left , FALSE);
rightOp = geniCodeRValue (right, FALSE);
leftOp = geniCodeRValue (left , FALSE);
rightOp = geniCodeRValue (right, FALSE);
- return geniCodeLogic (leftOp, rightOp, tree->opval.op);
+ return geniCodeLogic (leftOp, rightOp, tree->opval.op, tree);