This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Use of constraints when mapping C variables to ASM symbolic names?
- From: Andrew Haley <aph at redhat dot com>
- To: noloader at gmail dot com, David Brown <david at westcontrol dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 24 Aug 2015 09:46:50 +0100
- Subject: Re: Use of constraints when mapping C variables to ASM symbolic names?
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8mZN0_LcsuOD87JHszVC-qW1eow8kKWNPGNcrH3qXpYhQ at mail dot gmail dot com> <55D72E1E dot 8070208 at westcontrol dot com> <CAH8yC8=XRu8FQsVButzL1EdG5Bz1eeTuCy10gZyp0eeO1vbLGA at mail dot gmail dot com>
On 21/08/15 16:38, Jeffrey Walton wrote:
> I was done in under 15 minutes on that inferior compiler. That was
> write the code, compile the code, verify code generation by examining
> listing and verifying the code under the debugger with a live target.
> Under GCC, I'm into my second day because I can't directly use a C
> variable from an ASM block, and I can't seem to accurately express my
> intentions with the multi-line extended ASM.
I can't immediately see why you can't use a named operand to access
a C variable.
I suspect your difficulty is due to a lack of experience with GCC.
Rather than ask "How can I make GCC do it this way?" you might be
better to ask "What is the best way to solve this problem by using
GCC?" GCC's extended asm is the way it is for reasons to do with
getting the best performance and minimizing the amount of hand-written
assembly language you need. Yes, it takes some getting used to and
can be obscure.
Andrew.