public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Gaius Mulley <gaius@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1718] PR modula2/110126 variables are reported as unused when referenced by ASM fix Date: Mon, 12 Jun 2023 14:26:53 +0000 (GMT) [thread overview] Message-ID: <20230612142653.540833858436@sourceware.org> (raw) https://gcc.gnu.org/g:bf470895905e9152424076d1630a9d2c60de023b commit r14-1718-gbf470895905e9152424076d1630a9d2c60de023b Author: Gaius Mulley <gaiusmod2@gmail.com> Date: Mon Jun 12 15:25:39 2023 +0100 PR modula2/110126 variables are reported as unused when referenced by ASM fix This patch fixes the trash list of the asm statement. It introduces a separate build procedure for trashed elements. gcc/m2/ChangeLog: PR modula2/110126 * gm2-compiler/M2Quads.def (BuildAsmElement): Remove trash parameter. (BuildAsmTrash): New procedure. * gm2-compiler/M2Quads.mod (BuildAsmTrash): New procedure. (BuildAsmElement): Remove trash parameter. * gm2-compiler/P3Build.bnf (AsmTrashList): Rewrite. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com> Diff: --- gcc/m2/gm2-compiler/M2Quads.def | 26 ++++++++++++++++++++-- gcc/m2/gm2-compiler/M2Quads.mod | 48 ++++++++++++++++++++++++++++++++++++----- gcc/m2/gm2-compiler/P3Build.bnf | 24 ++++++--------------- 3 files changed, 73 insertions(+), 25 deletions(-) diff --git a/gcc/m2/gm2-compiler/M2Quads.def b/gcc/m2/gm2-compiler/M2Quads.def index 493111e7c1b..fcb59bbcf49 100644 --- a/gcc/m2/gm2-compiler/M2Quads.def +++ b/gcc/m2/gm2-compiler/M2Quads.def @@ -144,7 +144,7 @@ EXPORT QUALIFIED StartBuildDefFile, StartBuildModFile, EndBuildFile, IsAutoPushOn, PushAutoOn, PushAutoOff, PopAuto, PushInConstExpression, PopInConstExpression, IsInConstExpression, - MustCheckOverflow, BuildAsmElement ; + MustCheckOverflow, BuildAsmElement, BuildAsmTrash ; TYPE @@ -2734,7 +2734,29 @@ PROCEDURE IsInConstExpression () : BOOLEAN ; |------------------| |------------------| *) -PROCEDURE BuildAsmElement (input, output, trash: BOOLEAN) ; +PROCEDURE BuildAsmElement (input, output: BOOLEAN) ; + + +(* + BuildAsmTrash - the stack is expected to contain: + + + Entry Exit + ===== ==== + + Ptr -> + +------------------+ + | expr | tokpos | + |------------------| +------------------+ + | CurrentInterface | | CurrentInterface | + |------------------| |------------------| + | CurrentAsm | | CurrentAsm | + |------------------| |------------------| + | n | | n | + |------------------| |------------------| +*) + +PROCEDURE BuildAsmTrash ; END M2Quads. diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index 8639d5e5807..081e9311ae8 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -14421,7 +14421,7 @@ END AddVarientEquality ; |------------------| |------------------| *) -PROCEDURE BuildAsmElement (input, output, trash: BOOLEAN) ; +PROCEDURE BuildAsmElement (input, output: BOOLEAN) ; VAR n, str, expr, tokpos, CurrentInterface, @@ -14449,15 +14449,53 @@ BEGIN PutRegInterface (tokpos, CurrentInterface, n, name, str, expr, 0, NextQuad) END ; - IF trash + PushT (n) ; + PushT (CurrentAsm) ; + PushT (CurrentInterface) +END BuildAsmElement ; + + +(* + BuildAsmTrash - the stack is expected to contain: + + + Entry Exit + ===== ==== + + Ptr -> + +------------------+ + | expr | tokpos | + |------------------| +------------------+ + | CurrentInterface | | CurrentInterface | + |------------------| |------------------| + | CurrentAsm | | CurrentAsm | + |------------------| |------------------| + | n | | n | + |------------------| |------------------| +*) + +PROCEDURE BuildAsmTrash ; +VAR + n, expr, tokpos, + CurrentInterface, + CurrentAsm : CARDINAL ; +BEGIN + PopTtok (expr, tokpos) ; + PopT (CurrentInterface) ; + PopT (CurrentAsm) ; + Assert (IsGnuAsm (CurrentAsm) OR IsGnuAsmVolatile (CurrentAsm)) ; + PopT (n) ; + INC (n) ; + IF CurrentInterface = NulSym THEN - PutRegInterface (tokpos, CurrentInterface, n, name, str, expr, - 0, NextQuad) + CurrentInterface := MakeRegInterface () END ; + PutRegInterface (tokpos, CurrentInterface, n, NulName, NulSym, expr, + 0, NextQuad) ; PushT (n) ; PushT (CurrentAsm) ; PushT (CurrentInterface) -END BuildAsmElement ; +END BuildAsmTrash ; (* diff --git a/gcc/m2/gm2-compiler/P3Build.bnf b/gcc/m2/gm2-compiler/P3Build.bnf index 8fbe19111b6..e3cf96f5b42 100644 --- a/gcc/m2/gm2-compiler/P3Build.bnf +++ b/gcc/m2/gm2-compiler/P3Build.bnf @@ -126,7 +126,7 @@ FROM M2Quads IMPORT PushT, PopT, PushTF, PopTF, PopNothing, Annotate, BuildRetry, DisplayStack, AddVarientRange, AddVarientEquality, - BuildAsmElement, + BuildAsmElement, BuildAsmTrash, BeginVarient, EndVarient, BeginVarientList, EndVarientList, PushInConstExpression, PopInConstExpression, IsInConstExpression, BuildDefaultFieldAlignment, BuildPragmaField, @@ -1587,7 +1587,7 @@ AsmOperandName := ( NamedOperand AsmInputElement := AsmOperandName ConstExpression '(' Expression % IF Pass3 THEN - BuildAsmElement (TRUE, FALSE, FALSE) + BuildAsmElement (TRUE, FALSE) END % ')' @@ -1596,34 +1596,22 @@ AsmInputElement := AsmOperandName AsmOutputElement := AsmOperandName ConstExpression '(' Expression % IF Pass3 THEN - BuildAsmElement (FALSE, TRUE, FALSE) + BuildAsmElement (FALSE, TRUE) END % ')' =: -AsmTrashList := % VAR expr, tokpos : CARDINAL ; % +AsmTrashList := % VAR expr, tokpos: CARDINAL ; % [ ConstExpression % IF Pass3 THEN - PopTtok (expr, tokpos) ; - PushT (NulSym) ; - PushTtok (expr, tokpos) ; - BuildAsmElement (FALSE, FALSE, TRUE) ; - PopTtok (expr, tokpos) ; - PopNothing ; - PushTtok (expr, tokpos) ; + BuildAsmTrash END % ] { ',' ConstExpression % IF Pass3 THEN - PopTtok (expr, tokpos) ; - PushT (NulSym) ; - PushTtok (expr, tokpos) ; - BuildAsmElement (FALSE, FALSE, TRUE) ; - PopTtok (expr, tokpos) ; - PopNothing ; - PushTtok (expr, tokpos) ; + BuildAsmTrash END % } =:
reply other threads:[~2023-06-12 14:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230612142653.540833858436@sourceware.org \ --to=gaius@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).