* [RFC][C++] Attribute gnu::extended
@ 2023-11-15 2:59 Julian Waters
0 siblings, 0 replies; only message in thread
From: Julian Waters @ 2023-11-15 2:59 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 3028 bytes --]
I propose a new attribute for C++, labelled gnu::extended. This attribute
is for asm declarations, and the attribute marks them as extended asm. This
attribute shall contain all of the features of existing extended asm, but
also have additional features, described below.
gnu::extended(OutputOperands, InputOperands, Clobbers, Labels, Attributes)
OutputOperands - Output Operands, in the exact same syntax as existing
extended asm
Example: [result] "r" (variable)
InputOperands - Input Operands, in the same syntax as existing extended
asm.
Different from extended asm is the fact that
the Input Operands in the
extended attribute can take method calls as
proper inputs
Example: [parameter] "r" (method(2))
This will likely require some patching in the
assembly declaration
Clobbers - String Literal containing clobbered registers, in
the same syntax as existing
extended asm, but each string literal is
separated by spaces rather than
commas
Labels - List of Goto Labels, in the same syntax as
existing extended asm
Attributes - List of tokens indicating certain attributes this
asm declaration should have,
these are:
singleton: The asm declaration is only emitted once in the method
body that it is in,
subsequent appearances of any asm declarations with
the singleton directive
specified are discarded
count "asm name": The asm declaration is only emitted once in the method
body that it is in,
subsequent appearances of any asm declarations with the
count directive will
simply update %[asm name] in the string literal template
of the very first instance to
the number of times the asm declaration has appeared in
the method, including the
first time it has appeared
stack: Forces appearances of %= within the asm declaration to have
stack semantics, that
is, references to labels with %= will refer to the
innermost declaration, and each
subsequent reference to such labels will refer to the
previous declaration before the
innermost declaration, and so on.This is particularly
useful for using labels defined
across multiple asm declarations
volatile: Functions the same as extended asm declared as asm volatile
("");
patch: For input operands, the patch directive causes the operand
code to be patched into
the asm declaration directly above the line of asm code
that uses the operand,
rather than before the asm declaration itself, as is done
for existing extended asm
These are the list of features available for this new proposed attribute,
thoughts?
best regards,
Julian
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-15 3:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 2:59 [RFC][C++] Attribute gnu::extended Julian Waters
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).