diff options
author | Chris Lattner <sabre@nondot.org> | 2007-11-28 21:26:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-11-28 21:26:17 +0000 |
commit | 4045e6db8c74f71cfbaa6a3681527423679e76ff (patch) | |
tree | 665f0e3683723512a0daf6d0685682204315b19f /lib/Target | |
parent | 51c971701a80a6cdc8192fdcc1a8ea0255710731 (diff) | |
download | external_llvm-4045e6db8c74f71cfbaa6a3681527423679e76ff.zip external_llvm-4045e6db8c74f71cfbaa6a3681527423679e76ff.tar.gz external_llvm-4045e6db8c74f71cfbaa6a3681527423679e76ff.tar.bz2 |
Work around a GCC bug, producing this code:
unsigned char *llvm_cbe_X;
...
llvm_cbe_X = 0; *((void**)&llvm_cbe_X) = __builtin_stack_save();
instead of:
llvm_cbe_X = __builtin_stack_save();
See PR1809 for details.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44415 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 852e28d..2d18468 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -2573,6 +2573,12 @@ void CWriter::visitCallInst(CallInst &I) { writeOperand(I.getOperand(3)); Out << ")"; return; + case Intrinsic::stacksave: + // Emit this as: Val = 0; *((void**)&Val) = __builtin_stack_save() + // to work around GCC bugs (see PR1809). + Out << "0; *((void**)&" << GetValueName(&I) + << ") = __builtin_stack_save()"; + return; case Intrinsic::dbg_stoppoint: { // If we use writeOperand directly we get a "u" suffix which is rejected // by gcc. |