Changed codegen for postfix inc/dec operations by deferring them till sequence points.

This usually allows faster & smaller code.
Note that deferred operations must still be called at sequence points even if the whole expressions containing them had constant values.
This commit is contained in:
acqn
2020-04-16 17:19:16 +08:00
committed by Oliver Schmidt
parent bb7b69f513
commit 5c43d1e04f
9 changed files with 526 additions and 58 deletions

View File

@@ -320,6 +320,9 @@ static void Parse (void)
} else {
/* Parse the function body */
NewFunc (Entry, FuncDef);
/* Make sure we aren't omitting any work */
CheckDeferredOpAllDone ();
}
}
@@ -395,6 +398,8 @@ void Compile (const char* FileName)
/* DefineNumericMacro ("__STDC__", 1); <- not now */
DefineNumericMacro ("__STDC_HOSTED__", 1);
InitDeferredOps ();
/* Create the base lexical level */
EnterGlobalLevel ();
@@ -486,6 +491,8 @@ void Compile (const char* FileName)
}
}
DoneDeferredOps ();
if (Debug) {
PrintMacroStats (stdout);
}