diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-09-04 20:04:38 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-09-04 20:04:38 +0000 |
commit | 9b3e3dfc54d9823074407323b0a60ebd223cd721 (patch) | |
tree | 272fcb6b13b9be87c80535e7473a4b83d316f9a3 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 878065bb218dea18b7943a7b59a98050995200d9 (diff) | |
download | llvm-9b3e3dfc54d9823074407323b0a60ebd223cd721.zip llvm-9b3e3dfc54d9823074407323b0a60ebd223cd721.tar.gz llvm-9b3e3dfc54d9823074407323b0a60ebd223cd721.tar.bz2 |
MS inline asm: Allow __asm blocks to set a return value
If control falls off the end of a function after an __asm block, MSVC
assumes that the inline assembly filled the EAX and possibly EDX
registers with an appropriate return value. This functionality is used
in inline functions returning 64-bit integers in system headers, so we
need some amount of compatibility.
This is implemented in Clang by adding extra output constraints to every
inline asm block, and storing the resulting output registers into the
return value slot. If we see an asm block somewhere in the function
body, we emit a normal epilogue instead of marking the end of the
function with a return type unreachable.
Normal returns in functions not using this functionality will overwrite
the return value slot, and in most cases LLVM should be able to
eliminate the dead stores.
Fixes PR17201.
Reviewed By: majnemer
Differential Revision: http://reviews.llvm.org/D5177
llvm-svn: 217187
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 765a757..c03b9ab 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -265,6 +265,10 @@ public: /// In ARC, whether we should autorelease the return value. bool AutoreleaseResult; + /// Whether we processed a Microsoft-style asm block during CodeGen. These can + /// potentially set the return value. + bool SawAsmBlock; + const CodeGen::CGBlockInfo *BlockInfo; llvm::Value *BlockPointer; |