Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asm syntax pragma #23119

Merged
merged 7 commits into from
Dec 25, 2023
Merged

Asm syntax pragma #23119

merged 7 commits into from
Dec 25, 2023

Conversation

ASVIEST
Copy link
Contributor

@ASVIEST ASVIEST commented Dec 22, 2023

(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.

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

It can't generate different asm code for ICC because asmStmtFrmt is just string.
@ASVIEST ASVIEST changed the title Inline asm syntax pragma. Inline asm syntax pragma Dec 22, 2023
doc/manual_experimental.md Outdated Show resolved Hide resolved
compiler/ccgstmts.nim Outdated Show resolved Hide resolved
@ASVIEST
Copy link
Contributor Author

ASVIEST commented Dec 24, 2023

Done, I renamed it to asmSyntax

@ASVIEST ASVIEST changed the title Inline asm syntax pragma Asm syntax pragma Dec 24, 2023
@ASVIEST ASVIEST closed this Dec 24, 2023
@ASVIEST ASVIEST reopened this Dec 24, 2023
doc/manual_experimental.md Outdated Show resolved Hide resolved
doc/manual_experimental.md Outdated Show resolved Hide resolved
@Araq Araq merged commit 1324d2e into nim-lang:devel Dec 25, 2023
12 checks passed
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 1324d2e

Hint: mm: orc; opt: speed; options: -d:release
177583 lines; 7.570s; 768.242MiB peakmem

@ASVIEST ASVIEST deleted the inlineAsmSyntax-pragma branch December 25, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants