+void Store (ExprDesc* Expr, const Type* StoreType)
+/* Store the primary register into the location denoted by Expr. If StoreType
+ * is given, use this type when storing instead of Expr->Type. If StoreType
+ * is NULL, use Expr->Type instead.
+ */
+{
+ unsigned Flags;
+
+ /* If StoreType was not given, use Expr->Type instead */
+ if (StoreType == 0) {
+ StoreType = Expr->Type;
+ }
+
+ /* Prepare the code generator flags */
+ Flags = TypeOf (StoreType) | GlobalModeFlags (Expr);
+
+ /* Do the store depending on the location */
+ switch (ED_GetLoc (Expr)) {
+
+ case E_LOC_ABS:
+ /* Absolute: numeric address or const */
+ g_putstatic (Flags, Expr->IVal, 0);
+ break;
+
+ case E_LOC_GLOBAL:
+ /* Global variable */
+ g_putstatic (Flags, Expr->Name, Expr->IVal);
+ break;
+
+ case E_LOC_STATIC:
+ case E_LOC_LITERAL:
+ /* Static variable or literal in the literal pool */
+ g_putstatic (Flags, Expr->Name, Expr->IVal);
+ break;
+
+ case E_LOC_REGISTER:
+ /* Register variable */
+ g_putstatic (Flags, Expr->Name, Expr->IVal);
+ break;
+
+ case E_LOC_STACK:
+ /* Value on the stack */
+ g_putlocal (Flags, Expr->IVal, 0);
+ break;
+
+ case E_LOC_PRIMARY:
+ /* The primary register (value is already there) */
+ break;
+
+ case E_LOC_EXPR:
+ /* An expression in the primary register */
+ g_putind (Flags, Expr->IVal);
+ break;
+
+ default:
+ Internal ("Invalid location in Store(): 0x%04X", ED_GetLoc (Expr));
+ }
+
+ /* Assume that each one of the stores will invalidate CC */
+ ED_MarkAsUntested (Expr);
+}
+
+
+
+static void PreInc (ExprDesc* Expr)
+/* Handle the preincrement operators */
+{
+ unsigned Flags;
+ unsigned long Val;
+
+ /* Skip the operator token */
+ NextToken ();
+
+ /* Evaluate the expression and check that it is an lvalue */
+ hie10 (Expr);
+ if (!ED_IsLVal (Expr)) {
+ Error ("Invalid lvalue");
+ return;
+ }
+
+ /* We cannot modify const values */
+ if (IsQualConst (Expr->Type)) {
+ Error ("Increment of read-only variable");
+ }
+
+ /* Get the data type */
+ Flags = TypeOf (Expr->Type) | GlobalModeFlags (Expr) | CF_FORCECHAR | CF_CONST;
+
+ /* Get the increment value in bytes */
+ Val = IsTypePtr (Expr->Type)? CheckedPSizeOf (Expr->Type) : 1;
+
+ /* Check the location of the data */
+ switch (ED_GetLoc (Expr)) {
+
+ case E_LOC_ABS:
+ /* Absolute: numeric address or const */
+ g_addeqstatic (Flags, Expr->IVal, 0, Val);
+ break;
+
+ case E_LOC_GLOBAL:
+ /* Global variable */
+ g_addeqstatic (Flags, Expr->Name, Expr->IVal, Val);
+ break;
+
+ case E_LOC_STATIC:
+ case E_LOC_LITERAL:
+ /* Static variable or literal in the literal pool */
+ g_addeqstatic (Flags, Expr->Name, Expr->IVal, Val);
+ break;
+
+ case E_LOC_REGISTER:
+ /* Register variable */
+ g_addeqstatic (Flags, Expr->Name, Expr->IVal, Val);
+ break;
+
+ case E_LOC_STACK:
+ /* Value on the stack */
+ g_addeqlocal (Flags, Expr->IVal, Val);
+ break;
+
+ case E_LOC_PRIMARY:
+ /* The primary register */
+ g_inc (Flags, Val);
+ break;
+
+ case E_LOC_EXPR:
+ /* An expression in the primary register */
+ g_addeqind (Flags, Expr->IVal, Val);
+ break;
+
+ default:
+ Internal ("Invalid location in PreInc(): 0x%04X", ED_GetLoc (Expr));
+ }
+
+ /* Result is an expression, no reference */
+ ED_MakeRValExpr (Expr);
+}
+
+
+
+static void PreDec (ExprDesc* Expr)
+/* Handle the predecrement operators */
+{
+ unsigned Flags;
+ unsigned long Val;
+
+ /* Skip the operator token */
+ NextToken ();
+
+ /* Evaluate the expression and check that it is an lvalue */
+ hie10 (Expr);
+ if (!ED_IsLVal (Expr)) {
+ Error ("Invalid lvalue");
+ return;
+ }
+
+ /* We cannot modify const values */
+ if (IsQualConst (Expr->Type)) {
+ Error ("Decrement of read-only variable");
+ }
+
+ /* Get the data type */
+ Flags = TypeOf (Expr->Type) | GlobalModeFlags (Expr) | CF_FORCECHAR | CF_CONST;
+
+ /* Get the increment value in bytes */
+ Val = IsTypePtr (Expr->Type)? CheckedPSizeOf (Expr->Type) : 1;
+
+ /* Check the location of the data */
+ switch (ED_GetLoc (Expr)) {
+
+ case E_LOC_ABS:
+ /* Absolute: numeric address or const */
+ g_subeqstatic (Flags, Expr->IVal, 0, Val);
+ break;
+
+ case E_LOC_GLOBAL:
+ /* Global variable */
+ g_subeqstatic (Flags, Expr->Name, Expr->IVal, Val);
+ break;
+
+ case E_LOC_STATIC:
+ case E_LOC_LITERAL:
+ /* Static variable or literal in the literal pool */
+ g_subeqstatic (Flags, Expr->Name, Expr->IVal, Val);
+ break;
+
+ case E_LOC_REGISTER:
+ /* Register variable */
+ g_subeqstatic (Flags, Expr->Name, Expr->IVal, Val);
+ break;
+
+ case E_LOC_STACK:
+ /* Value on the stack */
+ g_subeqlocal (Flags, Expr->IVal, Val);
+ break;
+
+ case E_LOC_PRIMARY:
+ /* The primary register */
+ g_inc (Flags, Val);
+ break;