summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-28 21:26:17 +0000
committerChris Lattner <sabre@nondot.org>2007-11-28 21:26:17 +0000
commit246b7b2dbfd79f8dcef9285e362d312413062b1b (patch)
tree68e41bfe3d4c8da742d6e09dd91d43612d4d7b5b /llvm
parent3fbb6a83a8bf93cb3d023e64bdf3fc48ce8e6abb (diff)
downloadbcm5719-llvm-246b7b2dbfd79f8dcef9285e362d312413062b1b.tar.gz
bcm5719-llvm-246b7b2dbfd79f8dcef9285e362d312413062b1b.zip
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. llvm-svn: 44415
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index 852e28df874..2d18468215e 100644
--- a/llvm/lib/Target/CBackend/CBackend.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud