forked from OSchip/llvm-project
Add catch block handling to SjLj exception handling.
llvm-svn: 78817
This commit is contained in:
parent
e274526d78
commit
3cfc6463c9
|
@ -531,6 +531,11 @@ void DwarfException::EmitExceptionTable() {
|
||||||
const unsigned SiteLengthSize = sizeof(int32_t); // DW_EH_PE_udata4
|
const unsigned SiteLengthSize = sizeof(int32_t); // DW_EH_PE_udata4
|
||||||
const unsigned LandingPadSize = sizeof(int32_t); // DW_EH_PE_udata4
|
const unsigned LandingPadSize = sizeof(int32_t); // DW_EH_PE_udata4
|
||||||
unsigned SizeSites;
|
unsigned SizeSites;
|
||||||
|
|
||||||
|
bool HaveTTData = (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj)
|
||||||
|
? (!TypeInfos.empty() || !FilterIds.empty()) : true;
|
||||||
|
|
||||||
|
|
||||||
if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) {
|
if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj) {
|
||||||
SizeSites = (MF->getMaxCallSiteIndex() - CallSites.size()) *
|
SizeSites = (MF->getMaxCallSiteIndex() - CallSites.size()) *
|
||||||
TargetAsmInfo::getULEB128Size(0) * 2;
|
TargetAsmInfo::getULEB128Size(0) * 2;
|
||||||
|
@ -553,7 +558,8 @@ void DwarfException::EmitExceptionTable() {
|
||||||
|
|
||||||
unsigned TotalSize = sizeof(int8_t) + // LPStart format
|
unsigned TotalSize = sizeof(int8_t) + // LPStart format
|
||||||
sizeof(int8_t) + // TType format
|
sizeof(int8_t) + // TType format
|
||||||
TargetAsmInfo::getULEB128Size(TypeOffset) + // TType base offset
|
(HaveTTData ?
|
||||||
|
TargetAsmInfo::getULEB128Size(TypeOffset) : 0) + // TType base offset
|
||||||
TypeOffset;
|
TypeOffset;
|
||||||
|
|
||||||
unsigned SizeAlign = (4 - TotalSize) & 3;
|
unsigned SizeAlign = (4 - TotalSize) & 3;
|
||||||
|
@ -624,11 +630,10 @@ void DwarfException::EmitExceptionTable() {
|
||||||
Asm->EOL("TType base offset");
|
Asm->EOL("TType base offset");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// For SjLj exceptions, is there is no TypeInfo, then we just explicitly
|
// For SjLj exceptions, if there is no TypeInfo, then we just explicitly
|
||||||
// say that we're omitting that bit.
|
// say that we're omitting that bit.
|
||||||
// FIXME: does this apply to Dwarf also? The above #if 0 implies yes?
|
// FIXME: does this apply to Dwarf also? The above #if 0 implies yes?
|
||||||
if (TAI->getExceptionHandlingType() == ExceptionHandling::SjLj
|
if (!HaveTTData) {
|
||||||
&& (TypeInfos.empty() || FilterIds.empty())) {
|
|
||||||
Asm->EmitInt8(dwarf::DW_EH_PE_omit);
|
Asm->EmitInt8(dwarf::DW_EH_PE_omit);
|
||||||
Asm->EOL("TType format (DW_EH_PE_omit)");
|
Asm->EOL("TType format (DW_EH_PE_omit)");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -312,6 +312,10 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
|
||||||
setOperationAction(ISD::VAEND, MVT::Other, Expand);
|
setOperationAction(ISD::VAEND, MVT::Other, Expand);
|
||||||
setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
|
setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
|
||||||
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
|
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
|
||||||
|
setOperationAction(ISD::EHSELECTION, MVT::i32, Expand);
|
||||||
|
// FIXME: Shouldn't need this, since no register is used, but the legalizer
|
||||||
|
// doesn't yet know how to not do that for SjLj.
|
||||||
|
setExceptionSelectorRegister(ARM::R0);
|
||||||
if (Subtarget->isThumb())
|
if (Subtarget->isThumb())
|
||||||
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
|
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue