[Hexagon] Add option to generate calls to "abort" for "unreachable"

llvm-svn: 312644
This commit is contained in:
Krzysztof Parzyszek 2017-09-06 16:22:55 +00:00
parent bdc3e61d21
commit daf1a5f94e
2 changed files with 14 additions and 0 deletions

View File

@ -91,6 +91,10 @@ static cl::opt<bool> EnableVectorPrint("enable-hexagon-vector-print",
cl::Hidden, cl::ZeroOrMore, cl::init(false),
cl::desc("Enable Hexagon Vector print instr pass"));
static cl::opt<bool> EnableTrapUnreachable("hexagon-trap-unreachable",
cl::Hidden, cl::ZeroOrMore, cl::init(false),
cl::desc("Enable generating trap for unreachable"));
/// HexagonTargetMachineModule - Note that this is used on hosts that
/// cannot link in a library unless there are references into the
/// library. In particular, it seems that it is not possible to get
@ -195,6 +199,8 @@ HexagonTargetMachine::HexagonTargetMachine(const Target &T, const Triple &TT,
TT, CPU, FS, Options, getEffectiveRelocModel(RM),
getEffectiveCodeModel(CM), (HexagonNoOpt ? CodeGenOpt::None : OL)),
TLOF(make_unique<HexagonTargetObjectFile>()) {
if (EnableTrapUnreachable)
this->Options.TrapUnreachable = true;
initializeHexagonExpandCondsetsPass(*PassRegistry::getPassRegistry());
initAsmInfo();
}

View File

@ -0,0 +1,8 @@
; RUN: llc -march=hexagon -hexagon-trap-unreachable < %s | FileCheck %s
; CHECK: call abort
define void @fred() #0 {
unreachable
}
attributes #0 = { nounwind }