pedantic>1: "char c=200" is not allowed (evaluates to -56)
*/
-void checkConstantRange(sym_link *ltype, value *val, char *msg, int pedantic) {
+void checkConstantRange(sym_link *ltype, value *val, char *msg,
+ int pedantic) {
double max;
- char message[132]="";
int warnings=0;
int negative=0;
long v;
warnings++;
}
+#if 0 // temporary disabled, leaving the warning as a reminder
if (warnings) {
sprintf (message, "for %s %s in %s",
SPEC_USIGN(ltype) ? "unsigned" : "signed",
if (pedantic>1)
fatalError++;
}
+#endif
}
/*-----------------------------------------------------------------*/
return 0;
}
+
/*-----------------------------------------------------------------*/
/* isOperandInFarSpace - will return true if operand is in farSpace */
/*-----------------------------------------------------------------*/
return (IN_FARSPACE (SPEC_OCLS (etype)) ? TRUE : FALSE);
}
+/*------------------------------------------------------------------*/
+/* isOperandInDirSpace - will return true if operand is in dirSpace */
+/*------------------------------------------------------------------*/
+bool
+isOperandInDirSpace (operand * op)
+{
+ sym_link *etype;
+
+ if (!op)
+ return FALSE;
+
+ if (!IS_SYMOP (op))
+ return FALSE;
+
+ if (!IS_TRUE_SYMOP (op))
+ {
+ if (SPIL_LOC (op))
+ etype = SPIL_LOC (op)->etype;
+ else
+ return FALSE;
+ }
+ else
+ {
+ etype = getSpec (operandType (op));
+ }
+ return (IN_DIRSPACE (SPEC_OCLS (etype)) ? TRUE : FALSE);
+}
+
/*-----------------------------------------------------------------*/
/* isOperandOnStack - will return true if operand is on stack */
/*-----------------------------------------------------------------*/
+#if 0
bool
isOperandOnStack (operand * op)
{
return ((IN_STACK (etype)) ? TRUE : FALSE);
}
+#else
+bool
+isOperandOnStack (operand * op)
+{
+ sym_link *etype;
+
+ if (!op)
+ return FALSE;
+
+ if (!IS_SYMOP (op))
+ return FALSE;
+
+ etype = getSpec (operandType (op));
+ if (IN_STACK (etype) ||
+ OP_SYMBOL(op)->onStack ||
+ (SPIL_LOC(op) && SPIL_LOC(op)->onStack))
+ return TRUE;
+
+ return FALSE;
+}
+#endif
/*-----------------------------------------------------------------*/
/* operandLitValue - literal value of an operand */
return floatFromVal (op->operand.valOperand);
}
+/*-----------------------------------------------------------------*/
+/* getBuiltInParms - returns parameters to a builtin functions */
+/*-----------------------------------------------------------------*/
+iCode *getBuiltinParms (iCode *ic, int *pcount, operand **parms)
+{
+ sym_link *ftype;
+
+ *pcount = 0;
+ /* builtin functions uses only SEND for parameters */
+ while (ic->op != CALL) {
+ assert(ic->op == SEND && ic->builtinSEND);
+ ic->generated = 1; /* mark the icode as generated */
+ parms[*pcount] = IC_LEFT(ic);
+ ic = ic->next;
+ (*pcount)++;
+ }
+
+ ic->generated = 1;
+ /* make sure this is a builtin function call */
+ assert(IS_SYMOP(IC_LEFT(ic)));
+ ftype = operandType(IC_LEFT(ic));
+ assert(IFFUNC_ISBUILTIN(ftype));
+ return ic;
+}
+
/*-----------------------------------------------------------------*/
/* operandOperation - perforoms operations on operands */
/*-----------------------------------------------------------------*/
{
iCode *ic;
- // bitwise operations must be done unsigned
- // WHY ? causes very bad things to happen with CSE
- // SPEC_USIGN(resType)=1;
-
left = geniCodeCast (resType, left, TRUE);
right = geniCodeCast (resType, right, TRUE);
true = ast2iCode (tree->right->left,lvl+1);
/* move the value to a new Operand */
- result = newiTempOperand (operandType (true), 0);
+ result = newiTempOperand (tree->right->ftype, 0);
geniCodeAssign (result, geniCodeRValue (true, FALSE), 0);
/* generate an unconditional goto */
}
/* if register parm then make it a send */
- if (IS_REGPARM (parms->etype) && !IFFUNC_HASVARARGS(func->type))
+ if ((IS_REGPARM (parms->etype) && !IFFUNC_HASVARARGS(func->type)) ||
+ IFFUNC_ISBUILTIN(func->type))
{
ic = newiCode (SEND, pval, NULL);
+ ic->builtinSEND = FUNC_ISBUILTIN(func->type);
ADDTOCHAIN (ic);
}
else
/* assign */
operand *top = operandFromSymbol (argVals->sym);
+ /* clear useDef and other bitVectors */
+ OP_USES (top) = OP_DEFS (top) = OP_SYMBOL(top)->clashes = NULL;
geniCodeAssign (top, pval, 1);
}
else