linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/2] ARM: assembler: Add uniform assembler framework
Date: Tue, 28 Feb 2012 19:44:03 +0000	[thread overview]
Message-ID: <20120228194403.GC2063@linaro.org> (raw)
In-Reply-To: <20120228192458.GC3617@n2100.arm.linux.org.uk>

On Tue, Feb 28, 2012 at 07:24:59PM +0000, Russell King - ARM Linux wrote:
> On Tue, Feb 28, 2012 at 06:59:44PM +0000, Dave Martin wrote:
> > #ifdef __ASSEMBLY__
> > stuff
> > for
> > the
> > assembler
> > #else
> > asm("stuff");
> > asm("for");
> > asm("the");
> > asm("assembler");
> 
> That's invalid - nothing guarantees that the compiler won't place
> anything in between these asm statements in the output assembly
> file.

Within a function that would be certainly true -- at the top-level, I'm
less sure.  Since there is no sequential code at the top level, only
declarations, it's hard to see why the compiler would ever consider
pasting something in the middle of that block or reordering it.
Without constraints, the compiler simply has no idea what's there
(such asms are implicitly "volatile", though that could be added
for clarity).  You're right that all this may amount to less than a
guarantee, though...


One obvious improvement is to emit a single big asm statement for
each block.  There's still an assumption that the compiler will not
reorder stuff around that block -- unified.h actually already relies
on that prepoerty in order to work (though if we can find a better way,
we could migrate some of the unified.h stuff to use it).


Another option is to .include a separate file.

This is possible, but I hadn't figured out how to autogenerate the
correct dependencies if things are one that way.  Alternatively, the
.included file can be the header file itself, but this relies on
the fact that C preprocessor look like line comments to the assembler,
so it's rather painful.


If there is no other way to be certain that the included content really
does appear at the start of the compilation unit, it would be necessary
to wrap the assembler in a script which explicitly pastes that extra
stuff at the start -- but this doesn't feel like a desirable option,
since it's hard to avoid extra complexity and overheads when doing this.


Any thoughts?

Cheers
---Dave

  reply	other threads:[~2012-02-28 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 18:59 [RFC PATCH 0/2] ARM: assembler: Add uniform assembler framework Dave Martin
2012-02-28 18:59 ` [RFC PATCH 1/2] " Dave Martin
2012-02-28 18:59 ` [RFC PATCH 2/2] ARM: virt: Add assembler helpers for the Virtualization Extensions Dave Martin
2012-02-28 19:24 ` [RFC PATCH 0/2] ARM: assembler: Add uniform assembler framework Russell King - ARM Linux
2012-02-28 19:44   ` Dave Martin [this message]
2012-02-29 19:28     ` Dave Martin
2012-03-01 11:49   ` Dave Martin
2012-03-01 13:00     ` Russell King - ARM Linux
2012-03-01 13:20       ` Dave Martin
2012-03-02 21:42       ` Nicolas Pitre
2012-03-02 21:40     ` Nicolas Pitre

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=20120228194403.GC2063@linaro.org \
    --to=dave.martin@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).