Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llvm/include/llvm/Target/TargetMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ class LLVM_ABI TargetMachine {
const MCInstrInfo *getMCInstrInfo() const { return MII.get(); }
const MCSubtargetInfo *getMCSubtargetInfo() const { return STI.get(); }

/// Return the ExceptionHandling to use, considering TargetOptions and the
/// Triple's default.
ExceptionHandling getExceptionModel() const {
// FIXME: This interface fails to distinguish default from not supported.
return Options.ExceptionModel == ExceptionHandling::None
? TargetTriple.getDefaultExceptionHandling()
: Options.ExceptionModel;
}

bool requiresStructuredCFG() const { return RequireStructuredCFG; }
void setRequiresStructuredCFG(bool Value) { RequireStructuredCFG = Value; }

Expand Down
6 changes: 4 additions & 2 deletions llvm/lib/Target/ARM/ARMISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21959,14 +21959,16 @@ Register ARMTargetLowering::getExceptionPointerRegister(
const Constant *PersonalityFn) const {
// Platforms which do not use SjLj EH may return values in these registers
// via the personality function.
return Subtarget->useSjLjEH() ? Register() : ARM::R0;
ExceptionHandling EM = getTargetMachine().getExceptionModel();
return EM == ExceptionHandling::SjLj ? Register() : ARM::R0;
}

Register ARMTargetLowering::getExceptionSelectorRegister(
const Constant *PersonalityFn) const {
// Platforms which do not use SjLj EH may return values in these registers
// via the personality function.
return Subtarget->useSjLjEH() ? Register() : ARM::R1;
ExceptionHandling EM = getTargetMachine().getExceptionModel();
return EM == ExceptionHandling::SjLj ? Register() : ARM::R1;
}

void ARMTargetLowering::initializeSplitCSR(MachineBasicBlock *Entry) const {
Expand Down
14 changes: 0 additions & 14 deletions llvm/lib/Target/ARM/ARMSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ ForceFastISel("arm-force-fast-isel",
/// so that we can use initializer lists for subtarget initialization.
ARMSubtarget &ARMSubtarget::initializeSubtargetDependencies(StringRef CPU,
StringRef FS) {
initializeEnvironment();
initSubtargetFeatures(CPU, FS);
return *this;
}
Expand Down Expand Up @@ -137,19 +136,6 @@ bool ARMSubtarget::isXRaySupported() const {
return hasV6Ops() && hasARMOps() && !isTargetWindows();
}

void ARMSubtarget::initializeEnvironment() {
// 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() && !isTargetWatchABI() &&
Options.ExceptionModel == ExceptionHandling::None) ||
Options.ExceptionModel == ExceptionHandling::SjLj;
assert((!TM.getMCAsmInfo() ||
(TM.getMCAsmInfo()->getExceptionHandlingType() ==
ExceptionHandling::SjLj) == UseSjLjEH) &&
"inconsistent sjlj choice between CodeGen and MC");
}

void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
if (CPUString.empty()) {
CPUString = "generic";
Expand Down
5 changes: 0 additions & 5 deletions llvm/lib/Target/ARM/ARMSubtarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ class ARMSubtarget : public ARMGenSubtargetInfo {
/// blocks.
bool RestrictIT = false;

/// UseSjLjEH - If true, the target uses SjLj exception handling (e.g. iOS).
bool UseSjLjEH = false;

/// stackAlignment - The minimum alignment known to hold of the stack frame on
/// entry to the function and which must be maintained by every function.
Align stackAlignment = Align(4);
Expand Down Expand Up @@ -270,7 +267,6 @@ class ARMSubtarget : public ARMGenSubtargetInfo {
std::unique_ptr<LegalizerInfo> Legalizer;
std::unique_ptr<RegisterBankInfo> RegBankInfo;

void initializeEnvironment();
void initSubtargetFeatures(StringRef CPU, StringRef FS);
ARMFrameLowering *initializeFrameLowering(StringRef CPU, StringRef FS);

Expand Down Expand Up @@ -321,7 +317,6 @@ class ARMSubtarget : public ARMGenSubtargetInfo {
}
bool useFPVFMx16() const { return useFPVFMx() && hasFullFP16(); }
bool useFPVFMx64() const { return useFPVFMx() && hasFP64(); }
bool useSjLjEH() const { return UseSjLjEH; }
bool hasBaseDSP() const {
if (isThumb())
return hasThumb2() && hasDSP();
Expand Down
Loading