linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/3] add support for arch specific asm constraints
Date: Sat,  4 Jul 2020 15:57:45 +0200	[thread overview]
Message-ID: <20200704135747.87752-2-luc.vanoostenryck@gmail.com> (raw)
Message-ID: <20200704135745.lPH6Y2P4wYpTfErtl5P7dkdbBoepAoe793g873e9BRc@z> (raw)
In-Reply-To: <20200704135747.87752-1-luc.vanoostenryck@gmail.com>

When evaluating asm operands it must be known if they correspond
to a memory operand or not in order to process/ignore the 'noderef'
attribute.

This is done for operands specified with the common constraints
but not for the machine specific constraints.

So, add support for processing machine specific constraints.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c | 5 ++++-
 target.h   | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index 3b9aec3c13c0..f515ce6f2de6 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3642,7 +3642,10 @@ static void parse_asm_constraint(struct asm_operand *op)
 			return;
 
 		default:
-			// FIXME: arch-specific (and multi-letter) constraints
+			if (arch_target->asm_constraint)
+				str = arch_target->asm_constraint(op, c, str);
+
+			// FIXME: multi-letter constraints
 			break;
 		}
 	}
diff --git a/target.h b/target.h
index 8640026cc6d4..3ef0d520f83c 100644
--- a/target.h
+++ b/target.h
@@ -53,7 +53,7 @@ extern int pointer_alignment;
 extern int bits_in_enum;
 extern int enum_alignment;
 
-
+struct asm_operand;
 struct builtin_fn;
 
 struct target {
@@ -77,6 +77,7 @@ struct target {
 
 	void (*init)(const struct target *self);
 	void (*predefine)(const struct target *self);
+	const char *(*asm_constraint)(struct asm_operand *op, int c, const char *str);
 };
 
 extern const struct target target_default;
-- 
2.27.0


  reply	other threads:[~2020-07-04 13:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-04 13:57 [PATCH 0/3] teach sparse about arch specific asm constraints Luc Van Oostenryck
2020-07-04 13:57 ` Luc Van Oostenryck [this message]
2020-07-04 13:57   ` [PATCH 1/3] add support for " Luc Van Oostenryck
2020-07-04 13:57 ` [PATCH 2/3] add memory asm constraint for PPC Luc Van Oostenryck
2020-07-04 17:44   ` Ramsay Jones
2020-07-04 19:32     ` Luc Van Oostenryck
2020-07-04 21:07       ` Ramsay Jones
2020-07-04 22:44         ` Luc Van Oostenryck
2020-07-04 13:57 ` [PATCH 3/3] add memory asm constraint for S390 Luc Van Oostenryck

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=20200704135747.87752-2-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.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: link
Be 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 NNTP newsgroup(s).