{ARRAYINIT, "arrayInit", picGenericOne, NULL},
};
-// this makes it more easy to catch bugs
-struct bitVect *OP_DEFS(struct operand *op) {
- wassert (IS_SYMOP(op));
- return OP_SYMBOL(op)->defs;
-}
-struct bitVect *OP_DEFS_SET(struct operand *op, struct bitVect *bv) {
- wassert (IS_SYMOP(op));
- OP_SYMBOL(op)->defs=bv;
- return bv;
-}
-struct bitVect *OP_USES(struct operand *op) {
- wassert (IS_SYMOP(op));
- return OP_SYMBOL(op)->uses;
-}
-struct bitVect *OP_USES_SET(struct operand *op, struct bitVect *bv) {
- wassert (IS_SYMOP(op));
- OP_SYMBOL(op)->uses=bv;
- return bv;
-}
-
/*-----------------------------------------------------------------*/
/* checkConstantRange: check a constant against the type */
/*-----------------------------------------------------------------*/
{
if ((icTab = getTableEntry (loop->op)))
{
- fprintf (of, "%s(%d:%d:%d:%d:%d)\t",
+ fprintf (of, "%s(l%d:s%d:k%d:d%d:s%d)\t",
loop->filename, loop->lineno,
loop->seq, loop->key, loop->depth, loop->supportRtn);
ic = newiCode (op, NULL, NULL);
ic->op = op;
- ic->argLabel.label = label;
+ ic->label = label;
IC_LEFT (ic) = NULL;
IC_RIGHT (ic) = NULL;
IC_RESULT (ic) = NULL;
{
value *tval = args;
+ wassert (IS_SYMOP(op));
+
while (tval)
{
if (tval->sym &&
if (IS_ITEMP (op))
return 0;
- if (op->type == SYMBOL &&
+ if (IS_SYMOP(op) &&
(op->operand.symOperand->level == 0 ||
IS_STATIC (op->operand.symOperand->etype) ||
IS_EXTERN (op->operand.symOperand->etype))
symbol *element = getStructElement (SPEC_STRUCT (etype),
right->operand.symOperand);
+ wassert(IS_SYMOP(right));
+
/* add the offset */
ic = newiCode ('+', left, operandFromLit (element->offset));
/* assign */
operand *top = operandFromSymbol (argVals->sym);
/* clear useDef and other bitVectors */
- OP_USES_SET ((top), OP_DEFS_SET ((top), OP_SYMBOL(top)->clashes = NULL));
+ OP_USES(top)=OP_DEFS(top)=OP_SYMBOL(top)->clashes = NULL;
geniCodeAssign (top, pval, 1);
}
else
ast2iCode (tree,0);
return reverseiCChain ();
}
+
+static const char *opTypeToStr(OPTYPE op)
+{
+ switch(op)
+ {
+ case SYMBOL: return "symbol";
+ case VALUE: return "value";
+ case TYPE: return "type";
+ }
+ return "undefined type";
+}
+
+
+operand *validateOpType(operand *op,
+ const char *macro,
+ const char *args,
+ OPTYPE type,
+ const char *file,
+ unsigned line)
+{
+ if (op && op->type == type)
+ {
+ return op;
+ }
+ fprintf(stderr,
+ "Internal error: validateOpType failed in %s(%s) @ %s:%u:"
+ " expected %s, got %s\n",
+ macro, args, file, line,
+ opTypeToStr(type), op ? opTypeToStr(op->type) : "null op");
+ exit(-1);
+ return op; // never reached, makes compiler happy.
+}