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

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 03:26:25 PDT 2016


dsanders added a subscriber: dsanders.
dsanders added a comment.

MIPS avoids this problem in LLVM as a side-effect of something we did to match the assembler state that GCC uses for inline assembly. We emit a '.set push' in emitInlineAsmStart() to push the current assembler state onto a stack, followed by a few '.set ...' directives to change the state to what GCC uses. Then we emit a '.set pop' in emitInlineAsmEnd() to restore the state back to what we normally use for codegen. As a result, LLVM silently discards any state changes the user forgets to undo. This differs from GCC which will assume user did the right thing and will probably end up causing assembler errors or silent miscompilations.

That said, I think this kind of check is also useful for MIPS to catch portability bugs.


http://reviews.llvm.org/D20067





More information about the llvm-commits mailing list