case SYMBOL:
#define REGA 1
#ifdef REGA
- fprintf (file, "%s [k%d lr%d:%d so:%d]{ ia%d re%d rm%d nos%d ru%d}", /*{ar%d rm%d ru%d p%d a%d u%d i%d au%d k%d ks%d}" , */
+ fprintf (file, "%s [k%d lr%d:%d so:%d]{ ia%d re%d rm%d nos%d ru%d dp%d}", /*{ar%d rm%d ru%d p%d a%d u%d i%d au%d k%d ks%d}" , */
(OP_SYMBOL (op)->rname[0] ? OP_SYMBOL (op)->rname : OP_SYMBOL (op)->name),
op->key,
OP_LIVEFROM (op), OP_LIVETO (op),
OP_SYMBOL (op)->stack,
- op->isaddr, OP_SYMBOL (op)->isreqv, OP_SYMBOL (op)->remat,OP_SYMBOL(op)->noSpilLoc,
- OP_SYMBOL(op)->ruonly
+ op->isaddr, OP_SYMBOL (op)->isreqv,
+ OP_SYMBOL (op)->remat,OP_SYMBOL(op)->noSpilLoc,
+ OP_SYMBOL(op)->ruonly,OP_SYMBOL(op)->dptr
);
{
fprintf (file, "{");
if (!IC_RESULT (ic) && !IC_LEFT (ic))
fprintf (of, s);
+ if (ic->op == SEND || ic->op == RECEIVE) {
+ fprintf(of,"{argreg = %d}",ic->argreg);
+ }
fprintf (of, "\n");
}
return (IN_DIRSPACE (SPEC_OCLS (etype)) ? TRUE : FALSE);
}
-/*-----------------------------------------------------------------*/
-/* isOperandOnStack - will return true if operand is on stack */
-/*-----------------------------------------------------------------*/
-#if 0
+/*--------------------------------------------------------------------*/
+/* isOperandInCodeSpace - will return true if operand is in codeSpace */
+/*--------------------------------------------------------------------*/
bool
-isOperandOnStack (operand * op)
+isOperandInCodeSpace (operand * op)
{
sym_link *etype;
etype = getSpec (operandType (op));
- return ((IN_STACK (etype)) ? TRUE : 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_CODESPACE (SPEC_OCLS (etype)) ? TRUE : FALSE);
}
-#else
+
+/*-----------------------------------------------------------------*/
+/* isOperandOnStack - will return true if operand is on stack */
+/*-----------------------------------------------------------------*/
bool
isOperandOnStack (operand * op)
{
return FALSE;
}
-#endif
/*-----------------------------------------------------------------*/
/* operandLitValue - literal value of an operand */
/* perform "usual binary conversions" */
/*-----------------------------------------------------------------*/
sym_link *
-usualBinaryConversions (operand ** op1, operand ** op2, int implicit)
+usualBinaryConversions (operand ** op1, operand ** op2)
{
sym_link *ctype;
sym_link *rtype = operandType (*op2);
sym_link *ltype = operandType (*op1);
ctype = computeType (ltype, rtype);
- *op1 = geniCodeCast (ctype, *op1, implicit);
- *op2 = geniCodeCast (ctype, *op2, implicit);
+ *op1 = geniCodeCast (ctype, *op1, TRUE);
+ *op2 = geniCodeCast (ctype, *op2, TRUE);
return ctype;
}
if (IS_SPEC (type) &&
IS_TRUE_SYMOP (op) &&
(!IN_FARSPACE (SPEC_OCLS (etype)) ||
- /* TARGET_IS_DS390)) */
(options.model == MODEL_FLAT24) ))
{
op = operandFromOperand (op);
if (!IS_PTR(optype) && !IS_FUNC(optype) && !IS_AGGREGATE(optype)) { // from a non pointer
if (IS_INTEGRAL(optype)) {
// maybe this is NULL, than it's ok.
- // !implicit is always ok, e.g. "(char *) = (char *) + 3;"
- if (implicit &&
- !(IS_LITERAL(optype) && (SPEC_CVAL(optype).v_ulong ==0))) {
+ if (!(IS_LITERAL(optype) && (SPEC_CVAL(optype).v_ulong ==0))) {
if (!TARGET_IS_Z80 && !TARGET_IS_GBZ80 && IS_GENPTR(type)) {
// no way to set the storage
if (IS_LITERAL(optype)) {
werror(E_NONPTR2_GENPTR);
errors++;
}
- } else {
+ } else if (implicit) {
werror(W_INTEGRAL2PTR_NOCAST);
errors++;
}
/* preserve the storage class & output class */
/* of the original variable */
restype = getSpec (operandType (IC_RESULT (ic)));
- SPEC_SCLS (restype) = SPEC_SCLS (opetype);
+ if (!IS_LITERAL(opetype))
+ SPEC_SCLS (restype) = SPEC_SCLS (opetype);
SPEC_OCLS (restype) = SPEC_OCLS (opetype);
ADDTOCHAIN (ic);
p2 = powof2 ((unsigned long) floatFromVal (right->operand.valOperand));
}
- resType = usualBinaryConversions (&left, &right, TRUE);
+ resType = usualBinaryConversions (&left, &right);
#if 1
rtype = operandType (right);
retype = getSpec (rtype);
sym_link *ltype = operandType (left);
sym_link *letype = getSpec (ltype);
- resType = usualBinaryConversions (&left, &right, TRUE);
+ resType = usualBinaryConversions (&left, &right);
/* if the right is a literal & power of 2 */
/* then make it a right shift */
return operandFromValue (valMod (left->operand.valOperand,
right->operand.valOperand));
- resType = usualBinaryConversions (&left, &right, TRUE);
+ resType = usualBinaryConversions (&left, &right);
/* now they are the same size */
ic = newiCode ('%', left, right);
}
else
{ /* make them the same size */
- resType = usualBinaryConversions (&left, &right, TRUE);
+ resType = usualBinaryConversions (&left, &right);
}
ic = newiCode ('-', left, right);
/* geniCodeAdd - generates iCode for addition */
/*-----------------------------------------------------------------*/
operand *
-geniCodeAdd (operand * left, operand * right, int lvl, int ptrMath)
+geniCodeAdd (operand * left, operand * right, int lvl)
{
iCode *ic;
sym_link *resType;
if (IS_LITERAL (letype) && left->isLiteral && !floatFromVal (valFromType (letype)))
return right;
- /* if left is an array or pointer then size */
- if (ptrMath && IS_PTR (ltype))
+ /* if left is a pointer then size */
+ if (IS_PTR (ltype))
{
isarray = left->isaddr;
// there is no need to multiply with 1
}
else
{ // make them the same size
- resType = usualBinaryConversions (&left, &right, FALSE);
+ resType = usualBinaryConversions (&left, &right);
}
/* if they are both literals then we know */
{
left = geniCodeRValue (left, FALSE);
}
- return geniCodeDerefPtr (geniCodeAdd (left, right, lvl, 1), lvl);
+ return geniCodeDerefPtr (geniCodeAdd (left, right, lvl), lvl);
}
right = geniCodeMultiply (right,
OP_VALUE(right), "compare operation", 1);
}
- ctype = usualBinaryConversions (&left, &right, TRUE);
+ ctype = usualBinaryConversions (&left, &right);
ic = newiCode (op, left, right);
IC_RESULT (ic) = newiTempOperand (newCharLink (), 1);
IS_ADDRESS_OF_OP (parms->right))
parms->right->left->lvalue = 1;
- parms->opval.oprnd =
+ parms->opval.oprnd =
geniCodeRValue (ast2iCode (parms,lvl+1), FALSE);
-
+
parms->type = EX_OPERAND;
+ AST_ARGREG(parms) = SPEC_ARGREG(parms->etype);
}
/*-----------------------------------------------------------------*/
IFFUNC_ISBUILTIN(func->type))
{
ic = newiCode (SEND, pval, NULL);
+ ic->argreg = SPEC_ARGREG(parms->etype);
ic->builtinSEND = FUNC_ISBUILTIN(func->type);
ADDTOCHAIN (ic);
}
geniCodeParms (parms, NULL, &stack, getSpec (operandType (left)), OP_SYMBOL (left),lvl);
/* now call : if symbol then pcall */
- if (IS_OP_POINTER (left) || IS_ITEMP(left))
+ if (IS_OP_POINTER (left) || IS_ITEMP(left)) {
ic = newiCode (PCALL, left, NULL);
- else
+ } else {
ic = newiCode (CALL, left, NULL);
+ }
type = copyLinkChain (operandType (left)->next);
etype = getSpec (type);
/* for all arguments that are passed in registers */
while (args)
{
-
+ int first = 1;
if (IS_REGPARM (args->etype))
{
operand *opr = operandFromValue (args);
if (IN_FARSPACE (SPEC_OCLS (sym->etype)) &&
options.stackAuto == 0 &&
- /* !TARGET_IS_DS390) */
(!(options.model == MODEL_FLAT24)) )
{
}
}
}
- ic = newiCode (RECEIVE, NULL, NULL);
- currFunc->recvSize = getSize (sym->etype);
+ ic = newiCode (RECEIVE, NULL, NULL);
+ ic->argreg = SPEC_ARGREG(args->etype);
+ if (first) {
+ currFunc->recvSize = getSize (sym->type);
+ first = 0;
+ }
IC_RESULT (ic) = opr;
ADDTOCHAIN (ic);
}
/* create a proc icode */
ic = newiCode (FUNCTION, func, NULL);
- ic->lineno = OP_SYMBOL (func)->lineDef;
+ lineno=ic->lineno = OP_SYMBOL (func)->lineDef;
ADDTOCHAIN (ic);
operand *right = NULL;
if (!tree)
return NULL;
+
/* set the global variables for filename & line number */
if (tree->filename)
filename = tree->filename;
case '+':
if (right)
return geniCodeAdd (geniCodeRValue (left, FALSE),
- geniCodeRValue (right, FALSE),lvl, 0);
+ geniCodeRValue (right, FALSE),lvl);
else
return geniCodeRValue (left, FALSE); /* unary '+' has no meaning */
return geniCodeAssign (left,
geniCodeAdd (geniCodeRValue (operandFromOperand (left),
FALSE),
- right,lvl,1), 0);
+ right,lvl), 0);
}
case SUB_ASSIGN:
{