operand *geniCodeArray2Ptr (operand *);
operand *geniCodeRValue (operand *, bool);
operand *geniCodeDerefPtr (operand *,int);
+int isLvaluereq(int lvl);
#define PRINTFUNC(x) void x (FILE *of, iCode *ic, char *s)
/* forward definition of ic print functions */
itmplbl->isitmp = 1;
itmplbl->islbl = 1;
itmplbl->key = labelKey++;
- addSym (LabelTab, itmplbl, itmplbl->name, 0, 0);
+ addSym (LabelTab, itmplbl, itmplbl->name, 0, 0, 0);
return itmplbl;
}
itmplbl->isitmp = 1;
itmplbl->islbl = 1;
itmplbl->key = labelKey++;
- addSym (LabelTab, itmplbl, itmplbl->name, 0, 0);
+ addSym (LabelTab, itmplbl, itmplbl->name, 0, 0, 0);
return itmplbl;
}
operandOperation (operand * left, operand * right,
int op, sym_link * type)
{
- sym_link *let , *ret;
+ sym_link *let , *ret=NULL;
operand *retval = (operand *) 0;
assert (isOperandLiteral (left));
break;
case RRC:
{
- long i = operandLitValue (left);
+ long i = (long) operandLitValue (left);
retval = operandFromLit ((i >> (getSize (operandType (left)) * 8 - 1)) |
(i << 1));
break;
case RLC:
{
- long i = operandLitValue (left);
+ long i = (long) operandLitValue (left);
retval = operandFromLit ((i << (getSize (operandType (left)) * 8 - 1)) |
(i >> 1));
return (floatFromVal (left->operand.valOperand) ==
floatFromVal (right->operand.valOperand));
case TYPE:
- if (checkType (left->operand.typeOperand,
+ if (compareType (left->operand.typeOperand,
right->operand.typeOperand) == 1)
return 1;
}
/* operandFromLit - makes an operand from a literal value */
/*-----------------------------------------------------------------*/
operand *
-operandFromLit (float i)
+operandFromLit (double i)
{
return operandFromValue (valueFromLit (i));
}
{
if (IS_INTEGRAL (operandType (op)))
{
- if (getSize (operandType (op)) < INTSIZE)
+ if (getSize (operandType (op)) < (unsigned int) INTSIZE)
{
/* Widen to int. */
return geniCodeCast (INTTYPE, op, TRUE);
}
/* if the operand is already the desired type then do nothing */
- if (checkType (type, optype) == 1)
+ if (compareType (type, optype) == 1)
return op;
/* if this is a literal then just change the type & return */
!IS_GENPTR (type))
{
werror (E_INCOMPAT_CAST);
- werror (E_CONTINUE, "from type '");
+ fprintf (stderr, "from type '");
printTypeChain (optype, stderr);
fprintf (stderr, "' to type '");
printTypeChain (type, stderr);
if (resultIsInt)
{
SPEC_NOUN(getSpec(resType))=V_INT;
- SPEC_SHORT(getSpec(resType))=0;
}
/* if the right is a literal & power of 2 */
if port has 1 byte muldiv */
if (p2 && !IS_FLOAT (letype) &&
!((resultIsInt) && (getSize (resType) != getSize (ltype)) &&
- (port->muldiv.native_below == 1)))
+ (port->support.muldiv == 1)))
{
if ((resultIsInt) && (getSize (resType) != getSize (ltype)))
{
if (IS_LITERAL (retype) &&
!IS_FLOAT (letype) &&
(p2 = powof2 ((unsigned long)
- floatFromVal (right->operand.valOperand))))
- ic = newiCode (RIGHT_OP, left, operandFromLit (p2)); /* right shift */
+ floatFromVal (right->operand.valOperand)))) {
+ ic = newiCode (RIGHT_OP, left, operandFromLit (p2)); /* right shift */
+ }
else
{
ic = newiCode ('/', left, right); /* normal division */
if (IS_INTEGRAL (ltype) && IS_LITERAL (rtype))
{
int nbits = bitsForType (ltype);
- long v = operandLitValue (right);
+ long v = (long) operandLitValue (right);
- if (v > ((LONG_LONG) 1 << nbits) && v > 0)
+ if (v >= ((LONG_LONG) 1 << nbits) && v > 0)
werror (W_CONST_RANGE, " compare operation ");
}
if (IS_INTEGRAL (ltype) && right->type == VALUE && IS_LITERAL (rtype))
{
int nbits = bitsForType (ltype);
- long v = operandLitValue (right);
+ long v = (long) operandLitValue (right);
- if (v > ((LONG_LONG) 1 << nbits) && v > 0)
+ if (v >= ((LONG_LONG) 1 << nbits) && v > 0)
werror (W_CONST_RANGE, " = operation");
}
/* first check the type for pointer assignement */
if (left->isaddr && IS_PTR (ltype) && IS_ITEMP (left) &&
- checkType (ltype, rtype) < 0)
+ compareType (ltype, rtype) < 0)
{
- if (checkType (ltype->next, rtype) < 0)
+ if (compareType (ltype->next, rtype) < 0)
right = geniCodeCast (ltype->next, right, TRUE);
}
- else if (checkType (ltype, rtype) < 0)
+ else if (compareType (ltype, rtype) < 0)
right = geniCodeCast (ltype, right, TRUE);
/* if left is a true symbol & ! volatile
sym_link *rtype = operandType (right);
sym_link *ltype = operandType (left);
if (IS_PTR (rtype) && IS_ITEMP (right)
- && right->isaddr && checkType (rtype->next, ltype) == 1)
+ && right->isaddr && compareType (rtype->next, ltype) == 1)
right = geniCodeRValue (right, TRUE);
else
right = geniCodeRValue (right, FALSE);
sym_link *rtype = operandType (right);
sym_link *ltype = operandType (left);
if (IS_PTR (rtype) && IS_ITEMP (right)
- && right->isaddr && checkType (rtype->next, ltype) == 1)
+ && right->isaddr && compareType (rtype->next, ltype) == 1)
right = geniCodeRValue (right, TRUE);
else
right = geniCodeRValue (right, FALSE);
sym_link *rtype = operandType (right);
sym_link *ltype = operandType (left);
if (IS_PTR (rtype) && IS_ITEMP (right)
- && right->isaddr && checkType (rtype->next, ltype) == 1)
+ && right->isaddr && compareType (rtype->next, ltype) == 1)
{
right = geniCodeRValue (right, TRUE);
}