[PATCH] D20067: Error if inline assembly ends in unexpected mode

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 06:53:22 PDT 2016


jyknight added a subscriber: jyknight.
jyknight added a comment.

I agree this looks like a good idea, and I do also think it probably ought to be an error, since the effects are likely fairly tragic if you get it wrong.

So, ARM is expected to always restore the proper thumb/arm mode after any inline asm block. But, what should (on arm) .cpu, .arch, .arch_extension, and .fpu do in inline-asm? Or .cpu, and .arch on AArch64? Or the similar things on MIPS?

IMO, those should all emit hard errors if we detect that the mode ends up being different than expected after the inline-asm block too. Perhaps the code to detect mode-switches should be done generically for all arches, after calling emitInlineAsmEnd (to give it the chance to restore the mode if appropriate)?


http://reviews.llvm.org/D20067





More information about the llvm-commits mailing list