[PATCH] D11216: [ARM] Warnings for .cpu/.fpu/.arch directives in ASM

Renato Golin renato.golin at linaro.org
Mon Jul 20 01:04:00 PDT 2015


rengolin added a comment.

In http://reviews.llvm.org/D11216#207421, @rafael wrote:

> clang -c -flto -arch-opt-1 test1.c
>  clang -c -flto -arch-opt-2 test2.c
>  clang test1.o test2.o -o foo -Wl,-plugin-opt=save-temps
>  clang -c foo.s


No, because when we output assembly files, they have the correct set of directives in the correct place.

This only happens in two cases:

1. Users add them to inline assembly inside functions and forget that it leaks to the rest of the file

2. Users add them to assembly files, inside functions and forget that it leaks to the rest of the file



> Maybe the correct thing is to warn if the state is different at the start and end of an inline assembly?


This wouldn't catch the case where, accidentally, the user changes back to the original, because the order of directives happen to coincide with what you're compiling.

Example:

  foo:
    .fpu neon
  bar:
    .fpu vfpv3

This would "pass":

  $ clang -S -mfpu=vfpv3 foo.s

But this will warn:

  $ clang -S -mfpu=neon foo.s

Then, say, there's a code refactoring, and foo/bar get swapped places. Then the first warns and the second doesn't.


Repository:
  rL LLVM

http://reviews.llvm.org/D11216







More information about the llvm-commits mailing list