summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorASVIEST <71895914+ASVIEST@users.noreply.github.com>2023-12-25 09:12:54 +0300
committerGitHub <noreply@github.com>2023-12-25 07:12:54 +0100
commit1324d2e04cb11aaa96e9ba9efc69aee47ed6c1d8 (patch)
tree65b57ab57bac497235be76ec1a3b49c46461b8a9 /doc
parent6f3d3fdf9f4a718a7365ab98455903a7b18dade8 (diff)
downloadNim-1324d2e04cb11aaa96e9ba9efc69aee47ed6c1d8.tar.gz
Asm syntax pragma (#23119)
(Inspired by this pragma in nir asm PR)

`inlineAsmSyntax` pragma allowing specify target inline assembler syntax
in `asm` stmt.

It prevents compiling code with different of the target CC inline asm
syntax, i.e. it will not allow gcc inline asm code to be compiled with
vcc.

```nim
proc nothing() =
  asm {.inlineAsmSyntax: "gcc".} """
    nop
  """
```

The current C(C++) backend implementation cannot generate code for gcc
and for vcc at the same time. For example, `{.inlineAsmSyntax: "vcc".}`
with the ICC compiler will not generate code with intel asm syntax, even
though ICC can use both gcc-like asm and vcc-like. For implement support
for gcc and for vcc at the same time in ICC compiler, we need to
refactor extccomp

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'doc')
-rw-r--r--doc/manual_experimental.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/manual_experimental.md b/doc/manual_experimental.md
index 765a69a0f..9b52fbd2a 100644
--- a/doc/manual_experimental.md
+++ b/doc/manual_experimental.md
@@ -2595,3 +2595,20 @@ method foo(x: Base) {.base.} = discard
 ```
 
 It gives an error: method `foo` can be defined only in the same module with its type (Base).
+
+
+asmSyntax pragma
+================
+
+The `asmSyntax` pragma is used to specify target inline assembler syntax in an `asm` statement.
+
+It prevents compiling code with different of the target CC inline asm syntax, i.e. it will not allow gcc inline asm code to be compiled with vcc.
+
+```nim
+proc nothing() =
+  asm {.asmSyntax: "gcc".}"""
+    nop
+  """
+```
+
+The current C(C++) backend implementation cannot generate code for gcc and for vcc at the same time. For example, `{.asmSyntax: "vcc".}` with the ICC compiler will not generate code with intel asm syntax, even though ICC can use both gcc-like and vcc-like asm.