Changed OP_DEFS and OP_USES from macros to function to catch symbol abuse
[fw/sdcc] / src / SDCCicode.c
index 390c6c7263f33389ae5e651191d0c7a50a4d5c10..4ab359dc000872995b73e548e0cec1ef05681ae6 100644 (file)
@@ -115,6 +115,26 @@ iCodeTable codeTable[] =
   {ARRAYINIT, "arrayInit", picGenericOne, NULL},
 };
 
+// this makes it more easy to catch bugs
+struct bitVect *OP_DEFS(struct operand *op) {
+  assert (IS_SYMOP(op));
+  return OP_SYMBOL(op)->defs;
+}
+struct bitVect *OP_DEFS_SET(struct operand *op, struct bitVect *bv) {
+  assert (IS_SYMOP(op));
+  OP_SYMBOL(op)->defs=bv;
+  return bv;
+}
+struct bitVect *OP_USES(struct operand *op) {
+  assert (IS_SYMOP(op));
+  return OP_SYMBOL(op)->uses;
+}
+struct bitVect *OP_USES_SET(struct operand *op, struct bitVect *bv) {
+  assert (IS_SYMOP(op));
+  OP_SYMBOL(op)->uses=bv;
+  return bv;
+}
+
 /*-----------------------------------------------------------------*/
 /* checkConstantRange: check a constant against the type           */
 /*-----------------------------------------------------------------*/
@@ -2868,7 +2888,7 @@ geniCodeParms (ast * parms, value *argVals, int *stack,
          /* assign */
          operand *top = operandFromSymbol (argVals->sym);
          /* clear useDef and other bitVectors */
-         OP_USES (top) = OP_DEFS (top) = OP_SYMBOL(top)->clashes = NULL;
+         OP_USES_SET ((top), OP_DEFS_SET ((top), OP_SYMBOL(top)->clashes = NULL));
          geniCodeAssign (top, pval, 1);
        }
       else