summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86CallFrameOptimization.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-10-08 15:45:08 +0000
committerFrederic Riss <friss@apple.com>2015-10-08 15:45:08 +0000
commit263b772bda18a16b6785b8875ae26c77ba991361 (patch)
tree6901ec0f31dd42a00ca13be32edc59a68fc126ca /llvm/lib/Target/X86/X86CallFrameOptimization.cpp
parent46d311da19762fde07b2f43b5e4d615f4014f5ef (diff)
downloadbcm5719-llvm-263b772bda18a16b6785b8875ae26c77ba991361.tar.gz
bcm5719-llvm-263b772bda18a16b6785b8875ae26c77ba991361.zip
[X86] Disable X86CallFrameOptimization on Darwin in presence of EH
We emit 1 compact unwind encoding per function, and this can’t represent the varying stack pointer that will be generated by X86CallFrameOptimization. Disable the optimization on Darwin. (It might be possible to split the function into multiple ranges and emit 1 compact unwind info per range. The compact unwind emission code isn’t ready for that and this kind of info certainly isn’t tested/used anywhere. It might be worth exploring this path if we want to get the space savings at some point though) llvm-svn: 249694
Diffstat (limited to 'llvm/lib/Target/X86/X86CallFrameOptimization.cpp')
-rw-r--r--llvm/lib/Target/X86/X86CallFrameOptimization.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86CallFrameOptimization.cpp b/llvm/lib/Target/X86/X86CallFrameOptimization.cpp
index b1995694535..e3031b89464 100644
--- a/llvm/lib/Target/X86/X86CallFrameOptimization.cpp
+++ b/llvm/lib/Target/X86/X86CallFrameOptimization.cpp
@@ -26,6 +26,7 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/Function.h"
@@ -130,6 +131,11 @@ bool X86CallFrameOptimization::isLegal(MachineFunction &MF) {
if (STI.is64Bit())
return false;
+ // We can't encode multiple DW_CFA_GNU_args_size in the compact
+ // unwind encoding that Darwin uses.
+ if (STI.isTargetDarwin() && !MF.getMMI().getLandingPads().empty())
+ return false;
+
// You would expect straight-line code between call-frame setup and
// call-frame destroy. You would be wrong. There are circumstances (e.g.
// CMOV_GR8 expansion of a select that feeds a function call!) where we can
OpenPOWER on IntegriCloud