#include "global.h"
#include "goto.h"
#include "litpool.h"
+#include "loadexpr.h"
#include "locals.h"
#include "loop.h"
#include "pragma.h"
NextToken ();
/* Add the loop to the loop stack */
- AddLoop (StackPtr, BreakLabel, ContinueLabel);
+ AddLoop (BreakLabel, ContinueLabel);
/* Define the loop label */
g_defcodelabel (LoopLabel);
/* Add the loop to the loop stack. In case of a while loop, the loop head
* label is used for continue statements.
*/
- AddLoop (StackPtr, BreakLabel, LoopLabel);
+ AddLoop (BreakLabel, LoopLabel);
/* Define the head label */
g_defcodelabel (LoopLabel);
TypeConversion (&Expr, F_GetReturnType (CurrentFunc));
/* Load the value into the primary */
- ExprLoad (CF_NONE, &Expr);
+ LoadExpr (CF_NONE, &Expr);
}
} else if (!F_HasVoidReturn (CurrentFunc) && !F_HasOldStyleIntRet (CurrentFunc)) {
/* Add the loop to the loop stack. A continue jumps to the start of the
* the increment condition.
*/
- AddLoop (StackPtr, BreakLabel, IncLabel);
+ AddLoop (BreakLabel, IncLabel);
/* Skip the opening paren */
ConsumeLParen ();
ConsumeSemi ();
/* Remember the start of the increment expression */
- IncExprStart = GetCodePos();
+ GetCodePos (&IncExprStart);
/* Label for the increment expression */
g_defcodelabel (IncLabel);
g_jump (TestLabel);
/* Remember the end of the increment expression */
- IncExprEnd = GetCodePos();
+ GetCodePos (&IncExprEnd);
/* Skip the closing paren */
ConsumeRParen ();
* the loop body.
*/
if (HaveIncExpr) {
- MoveCode (IncExprStart, IncExprEnd, GetCodePos());
+ CodeMark Here;
+ GetCodePos (&Here);
+ MoveCode (&IncExprStart, &IncExprEnd, &Here);
} else {
/* Jump back to the increment expression */
g_jump (IncLabel);
{
ExprDesc Expr;
int GotBreak;
- CodeMark Start;
+ CodeMark Start, End;
/* Assume no pending token */
if (PendingToken) {
default:
/* Remember the current code position */
- Start = GetCodePos ();
+ GetCodePos (&Start);
/* Actual statement */
ExprWithCheck (hie0, &Expr);
/* Load the result only if it is an lvalue and the type is
* marked as volatile. Otherwise the load is useless.
*/
if (ED_IsLVal (&Expr) && IsQualVolatile (Expr.Type)) {
- ExprLoad (CF_NONE, &Expr);
+ LoadExpr (CF_NONE, &Expr);
}
/* If the statement didn't generate code, and is not of type
- * void, emit a warning
- */
- if (GetCodePos () == Start && !IsTypeVoid (Expr.Type)) {
+ * void, emit a warning.
+ */
+ GetCodePos (&End);
+ if (CodeRangeIsEmpty (&Start, &End) && !IsTypeVoid (Expr.Type)) {
Warning ("Statement has no effect");
}
CheckSemi (PendingToken);