[cfe-dev] reserved registers on inline asm clobber list silently ignored
Ties Stuij via cfe-dev
cfe-dev at lists.llvm.org
Thu Jul 5 07:01:40 PDT 2018
I'm looking at an issue where when specifying a reserved register (fp, base pointer) on the clobber list of an asm() statement, we don't preserve the original value across the asm code. Practically the register in the clobber list is ignored in this case, so if we're overwriting it in our asm code, we have problems.
As the clobber list is a GCC extension, I looked at the GCC behaviour, and GCC is doing roughly the same thing. There is a GCC bug out on this (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11807), and the opinions are somewhat divided on how to proceed.
There's a few ways in which we think we'd like to resolve this:
1 - leave as is, and be in line with GCC
2 - error when we see the SP and PC on the clobber list, otherwise store and load around the assembly code
3 - error on any reserved register on the clobber list
Where option 1 doesn't sound like a very nice option to me as it's counter-intuitive, and seems quite shoot-in-the-foot-y.
Any opinions on this?
More information about the cfe-dev