summaryrefslogtreecommitdiffstats
path: root/contrib/llvm
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-06-20 18:25:10 +0000
committerdim <dim@FreeBSD.org>2013-06-20 18:25:10 +0000
commitda3b12a1bbf9d2863451efdee810a0ee646494a9 (patch)
tree59b3d8016c1d3f62e4050627ecb0a51a51ae22be /contrib/llvm
parenta73b44b2ba93efe6e1e9eb0f6c57006739aa3f37 (diff)
downloadFreeBSD-src-da3b12a1bbf9d2863451efdee810a0ee646494a9.zip
FreeBSD-src-da3b12a1bbf9d2863451efdee810a0ee646494a9.tar.gz
Pull in r183984 from llvm trunk:
Make PrologEpilogInserter save/restore all callee saved registers in functions which call __builtin_unwind_init() __builtin_unwind_init() is an undocumented gcc intrinsic which has this effect, and is used in libgcc_eh. Goes part of the way toward fixing PR8541. This obsoletes the ugly hack to libgcc's unwind code from r245272, and should also work for other arches, so revert the hack too.
Diffstat (limited to 'contrib/llvm')
-rw-r--r--contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 959dd7d..9487cbd 100644
--- a/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -29,6 +29,7 @@
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/IR/InlineAsm.h"
@@ -214,7 +215,8 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &F) {
std::vector<CalleeSavedInfo> CSI;
for (unsigned i = 0; CSRegs[i]; ++i) {
unsigned Reg = CSRegs[i];
- if (F.getRegInfo().isPhysRegUsed(Reg)) {
+ // Functions which call __builtin_unwind_init get all their registers saved.
+ if (F.getRegInfo().isPhysRegUsed(Reg) || F.getMMI().callsUnwindInit()) {
// If the reg is modified, save it!
CSI.push_back(CalleeSavedInfo(Reg));
}
OpenPOWER on IntegriCloud