ok = 0;
if (!IS_AGGREGATE (sym->type) && /* not an aggregate */
- !IS_FUNC (sym->type) && /* not a function */
- !sym->_isparm && /* not a parameter */
- sym->level && /* is a local variable */
- !sym->addrtaken && /* whose address has not been taken */
- !sym->reqv && /* does not already have a reg equivalence */
+ !IS_FUNC (sym->type) && /* not a function */
+ !sym->_isparm && /* not a parameter */
+ IS_AUTO (sym) && /* is a local auto variable */
+ !sym->addrtaken && /* whose address has not been taken */
+ !sym->reqv && /* does not already have a reg equivalence */
!IS_VOLATILE (sym->etype) && /* not declared as volatile */
- !IS_STATIC (sym->etype) && /* and not declared static */
- !sym->islbl && /* not a label */
- ok && /* farspace check */
- !IS_BITVAR (sym->etype) /* not a bit variable */
+ !sym->islbl && /* not a label */
+ ok && /* farspace check */
+ !IS_BITVAR (sym->etype) /* not a bit variable */
)
{
return ptype;
}
+/*------------------------------------------------------------------*/
+/* aggrToPtrDclType - like aggrToPtr, but returns only the DCL_TYPE */
+/*------------------------------------------------------------------*/
+int
+aggrToPtrDclType (sym_link * type, bool force)
+{
+ if (IS_PTR (type) && !force)
+ return DCL_TYPE (type);
+
+ /* return the pointer depending on the storage class */
+ return PTR_TYPE (SPEC_OCLS (getSpec (type)));
+}
+
/*-----------------------------------------------------------------*/
/* geniCodeArray2Ptr - array to pointer */
/*-----------------------------------------------------------------*/
ADDTOCHAIN (ic);
(void) geniCodeAssign (op, result, 0, 0);
- if (lvalue || IS_TRUE_SYMOP (op))
+ if (lvalue || IS_TRUE_SYMOP (op) || IS_BITVAR (optype))
return op;
else
return result;
ADDTOCHAIN (ic);
(void) geniCodeAssign (op, result, 0, 0);
- if (lvalue || IS_TRUE_SYMOP (op))
+ if (lvalue || IS_TRUE_SYMOP (op) || IS_BITVAR (optype))
return op;
else
return result;
/* create a proc icode */
ic = newiCode (FUNCTION, func, NULL);
lineno=ic->lineno = OP_SYMBOL (func)->lineDef;
+ ic->tree = tree;
ADDTOCHAIN (ic);
/* now generate the end proc */
ic = newiCode (ENDFUNCTION, func, NULL);
+ ic->tree = tree;
ADDTOCHAIN (ic);
return;
}
falseLabel = newiTempLabel (buffer);
+ /* If cond is volatile, it might change after the boundary */
+ /* conditions are tested to an out of bounds value, causing */
+ /* a jump to a location outside of the jump table. To avoid */
+ /* this possibility, use a non-volatile copy of it instead. */
+ if (IS_OP_VOLATILE (cond))
+ {
+ operand * newcond;
+ iCode * ic;
+
+ newcond = newiTempOperand (operandType (cond), TRUE);
+ newcond->isvolatile = 0;
+ ic = newiCode ('=', NULL, cond);
+ IC_RESULT (ic) = newcond;
+ ADDTOCHAIN (ic);
+ cond = newcond;
+ }
+
/* so we can create a jumptable */
/* first we rule out the boundary conditions */
/* if only optimization says so */