mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
[CodeGen] Force emission of personality directive if explicitly specified
Summary: Before this change, personality directives were not emitted if there was no invoke left in the function (of course until recently this also meant that we couldn't know what the personality actually was). This patch forces personality directives to still be emitted, unless it is known to be a noop in the absence of invokes, or the user explicitly specified `nounwind` (and not `uwtable`) on the function. Reviewers: majnemer, rnk Subscribers: rnk, llvm-commits Differential Revision: http://reviews.llvm.org/D10884 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242185 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -69,24 +69,32 @@ void ARMException::beginFunction(const MachineFunction *MF) {
|
||||
///
|
||||
void ARMException::endFunction(const MachineFunction *MF) {
|
||||
ARMTargetStreamer &ATS = getTargetStreamer();
|
||||
const Function *F = MF->getFunction();
|
||||
const Function *Per = nullptr;
|
||||
if (F->hasPersonalityFn())
|
||||
Per = dyn_cast<Function>(F->getPersonalityFn()->stripPointerCasts());
|
||||
assert(!MMI->getPersonality() || Per == MMI->getPersonality());
|
||||
bool forceEmitPersonality =
|
||||
F->hasPersonalityFn() && !isNoOpWithoutInvoke(classifyEHPersonality(Per)) &&
|
||||
F->needsUnwindTableEntry();
|
||||
bool shouldEmitPersonality = forceEmitPersonality ||
|
||||
!MMI->getLandingPads().empty();
|
||||
if (!Asm->MF->getFunction()->needsUnwindTableEntry() &&
|
||||
MMI->getLandingPads().empty())
|
||||
!shouldEmitPersonality)
|
||||
ATS.emitCantUnwind();
|
||||
else {
|
||||
if (!MMI->getLandingPads().empty()) {
|
||||
// Emit references to personality.
|
||||
if (const Function *Personality = MMI->getPersonality()) {
|
||||
MCSymbol *PerSym = Asm->getSymbol(Personality);
|
||||
Asm->OutStreamer->EmitSymbolAttribute(PerSym, MCSA_Global);
|
||||
ATS.emitPersonality(PerSym);
|
||||
}
|
||||
|
||||
// Emit .handlerdata directive.
|
||||
ATS.emitHandlerData();
|
||||
|
||||
// Emit actual exception table
|
||||
emitExceptionTable();
|
||||
else if (shouldEmitPersonality) {
|
||||
// Emit references to personality.
|
||||
if (Per) {
|
||||
MCSymbol *PerSym = Asm->getSymbol(Per);
|
||||
Asm->OutStreamer->EmitSymbolAttribute(PerSym, MCSA_Global);
|
||||
ATS.emitPersonality(PerSym);
|
||||
}
|
||||
|
||||
// Emit .handlerdata directive.
|
||||
ATS.emitHandlerData();
|
||||
|
||||
// Emit actual exception table
|
||||
emitExceptionTable();
|
||||
}
|
||||
|
||||
if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
|
||||
|
Reference in New Issue
Block a user