You need to sign in or sign up before continuing.
[clang][X86] Update excessive register save diagnostic to more closely follow...
[clang][X86] Update excessive register save diagnostic to more closely follow the interrupt attribute spec The original diagnostic does not cover all cases according to my reading of the spec. For the interrupt attribute, the spec indicates that if the compiler does not support saving SSE, MMX, or x87 then the function should be compiled with '-mgeneral-regs-only' (GCC requires this). Alternatively, calling functions with the `no_caller_saved_registers` attribute will not clobber state and can be done without disabling these features. The warning as implemented in upstream only detects the latter case but does not consider that disabling the above features also solves the issue of these register saves being undesirable due to inefficiency. For the no_caller_saved_registers attribute, the interrupt spec also indicates that in the absence of saving SSE, MMX and x87 state, these functions should be compiled with '-mgeneral-regs-only' (also required by GCC). It does not make any statements about calling other functions with the attribute, but by extension the result is the same as with the interrupt attribute (in clang, at least). This patch handles the remaining cases by adjusting the diagnostic to: 1. Not be shown if the function is compiled without the SSE, MMX or x87 features enabled (i.e. with '-mgeneral-regs-only') 2. Also be shown for functions with the 'no_caller_saved_registers' attribute 3. In addition to advising that the function should only call functions with the `no_caller_saved_registers` attribute, the text also suggests compiling with `-mgeneral-regs-only` as an alternative. The interrupt spec is available at https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5ed3cc7b66af4758f7849ed6f65f4365be8223be and was taken from the issue that resulted in this diagnostic being added (#26787) Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D159068
parent
b8df24e7
Please register or sign in to comment