diff options
author | David Spickett <david.spickett@linaro.org> | 2024-02-13 10:38:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 10:38:38 +0000 |
commit | 9ca1a1575a337931d0e49859f83a0d5b70916abd (patch) | |
tree | 436ff4bafa3de5aa4a775f4c17bbf6af7c702ce7 /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | |
parent | fe3406e349884e4ef61480dd0607f1e237102c74 (diff) | |
download | llvm-9ca1a1575a337931d0e49859f83a0d5b70916abd.zip llvm-9ca1a1575a337931d0e49859f83a0d5b70916abd.tar.gz llvm-9ca1a1575a337931d0e49859f83a0d5b70916abd.tar.bz2 |
[flang][Driver] Add -masm option to flang (#81490)
The motivation here was a suggestion over in Compiler Explorer. You can
use `-mllvm` already to do this but since gfortran supports `-masm`, I
figured I'd try to add it.
This is done by flang expanding `-masm` into `-mllvm x86-asm-syntax=`,
then passing that to fc1. Which then collects all the `-mllvm` options
and forwards them on.
The code to expand it comes from clang `Clang::AddX86TargetArgs` (there
are some other places doing the same thing too). However I've removed
the `-inline-asm` that clang adds, as fortran doesn't have inline
assembly.
So `-masm` for flang purely changes the style of assembly output.
```
$ ./bin/flang-new /tmp/test.f90 -o - -S -target x86_64-linux-gnu
<...>
pushq %rbp
$ ./bin/flang-new /tmp/test.f90 -o - -S -target x86_64-linux-gnu -masm=att
<...>
pushq %rbp
$ ./bin/flang-new /tmp/test.f90 -o - -S -target x86_64-linux-gnu -masm=intel
<...>
push rbp
```
The test is adapted from `clang/test/Driver/masm.c` by removing the
clang-cl related lines and changing the 32 bit triples to 64 bit triples
since flang doesn't support 32 bit targets.
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
0 files changed, 0 insertions, 0 deletions