diff options
author | Tim Northover <tnorthover@apple.com> | 2015-11-18 21:10:39 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2015-11-18 21:10:39 +0000 |
commit | 747ae9a7ded98cbfe70134c3f710841a19215c3d (patch) | |
tree | 0b7714ed2cb7d5c054f7a6cc1212a87be076799f /llvm/lib/Target/ARM/ARMSubtarget.cpp | |
parent | cc2e76d57f45e920ecc9a60b543ecc3d8ac03ac8 (diff) | |
download | llvm-747ae9a7ded98cbfe70134c3f710841a19215c3d.zip llvm-747ae9a7ded98cbfe70134c3f710841a19215c3d.tar.gz llvm-747ae9a7ded98cbfe70134c3f710841a19215c3d.tar.bz2 |
ARM: make sure backend is consistent about exception handling method.
It turns out we decide whether to use SjLj exceptions or some alternative in
two separate places in the backend, and they disagreed with each other. This
led to inconsistent code and is generally a terrible idea.
So make them consistent and add an assert that they *do* match (unfortunately
MCAsmInfo isn't available in opt, so it can't be used to initialise the CodeGen
version directly).
llvm-svn: 253502
Diffstat (limited to 'llvm/lib/Target/ARM/ARMSubtarget.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMSubtarget.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMSubtarget.cpp b/llvm/lib/Target/ARM/ARMSubtarget.cpp index 52b1889..9e3cd36 100644 --- a/llvm/lib/Target/ARM/ARMSubtarget.cpp +++ b/llvm/lib/Target/ARM/ARMSubtarget.cpp @@ -26,6 +26,7 @@ #include "llvm/IR/Attributes.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalValue.h" +#include "llvm/MC/MCAsmInfo.h" #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetOptions.h" @@ -151,8 +152,15 @@ void ARMSubtarget::initializeEnvironment() { UseNaClTrap = false; GenLongCalls = false; UnsafeFPMath = false; - UseSjLjEH = (isTargetDarwin() && - TargetTriple.getSubArch() != Triple::ARMSubArch_v7k); + + // MCAsmInfo isn't always present (e.g. in opt) so we can't initialize this + // directly from it, but we can try to make sure they're consistent when both + // available. + UseSjLjEH = isTargetDarwin() && !isTargetWatchOS(); + assert((!TM.getMCAsmInfo() || + (TM.getMCAsmInfo()->getExceptionHandlingType() == + ExceptionHandling::SjLj) == UseSjLjEH) && + "inconsistent sjlj choice between CodeGen and MC"); } void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { |