mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
make DwarfException not inherit from DwarfPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100374 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -39,7 +39,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
DwarfException::DwarfException(AsmPrinter *A)
|
DwarfException::DwarfException(AsmPrinter *A)
|
||||||
: DwarfPrinter(A), shouldEmitTable(false), shouldEmitMoves(false),
|
: Asm(A), MMI(Asm->MMI), shouldEmitTable(false), shouldEmitMoves(false),
|
||||||
shouldEmitTableModule(false), shouldEmitMovesModule(false),
|
shouldEmitTableModule(false), shouldEmitMovesModule(false),
|
||||||
ExceptionTimer(0) {
|
ExceptionTimer(0) {
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
@ -55,10 +55,10 @@ DwarfException::~DwarfException() {
|
|||||||
/// in every non-empty .debug_frame section.
|
/// in every non-empty .debug_frame section.
|
||||||
void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
|
void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
|
||||||
// Size and sign of stack growth.
|
// Size and sign of stack growth.
|
||||||
int stackGrowth =
|
int stackGrowth = Asm->getTargetData().getPointerSize();
|
||||||
Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
|
if (Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
|
||||||
TargetFrameInfo::StackGrowsUp ?
|
TargetFrameInfo::StackGrowsDown)
|
||||||
TD->getPointerSize() : -TD->getPointerSize();
|
stackGrowth *= -1;
|
||||||
|
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
|
|
||||||
@ -131,6 +131,8 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
|
|||||||
Asm->EmitULEB128(1, "CIE Code Alignment Factor");
|
Asm->EmitULEB128(1, "CIE Code Alignment Factor");
|
||||||
Asm->EmitSLEB128(stackGrowth, "CIE Data Alignment Factor");
|
Asm->EmitSLEB128(stackGrowth, "CIE Data Alignment Factor");
|
||||||
Asm->OutStreamer.AddComment("CIE Return Address Column");
|
Asm->OutStreamer.AddComment("CIE Return Address Column");
|
||||||
|
|
||||||
|
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
|
||||||
Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true));
|
Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true));
|
||||||
|
|
||||||
if (Augmentation[0]) {
|
if (Augmentation[0]) {
|
||||||
@ -156,7 +158,8 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
|
|||||||
// On Darwin the linker honors the alignment of eh_frame, which means it must
|
// On Darwin the linker honors the alignment of eh_frame, which means it must
|
||||||
// be 8-byte on 64-bit targets to match what gcc does. Otherwise you get
|
// be 8-byte on 64-bit targets to match what gcc does. Otherwise you get
|
||||||
// holes which confuse readers of eh_frame.
|
// holes which confuse readers of eh_frame.
|
||||||
Asm->EmitAlignment(TD->getPointerSize() == 4 ? 2 : 3, 0, 0, false);
|
Asm->EmitAlignment(Asm->getTargetData().getPointerSize() == 4 ? 2 : 3,
|
||||||
|
0, 0, false);
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_common_end", Index));
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_common_end", Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,13 +182,13 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
|||||||
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,MCSA_Global);
|
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,MCSA_Global);
|
||||||
|
|
||||||
// If corresponding function is weak definition, this should be too.
|
// If corresponding function is weak definition, this should be too.
|
||||||
if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective())
|
if (TheFunc->isWeakForLinker() && Asm->MAI->getWeakDefDirective())
|
||||||
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
||||||
MCSA_WeakDefinition);
|
MCSA_WeakDefinition);
|
||||||
|
|
||||||
// If corresponding function is hidden, this should be too.
|
// If corresponding function is hidden, this should be too.
|
||||||
if (TheFunc->hasHiddenVisibility())
|
if (TheFunc->hasHiddenVisibility())
|
||||||
if (MCSymbolAttr HiddenAttr = MAI->getHiddenVisibilityAttr())
|
if (MCSymbolAttr HiddenAttr = Asm->MAI->getHiddenVisibilityAttr())
|
||||||
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
||||||
HiddenAttr);
|
HiddenAttr);
|
||||||
|
|
||||||
@ -195,14 +198,14 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
|||||||
// info is to be available for non-EH uses.
|
// info is to be available for non-EH uses.
|
||||||
if (!EHFrameInfo.hasCalls && !UnwindTablesMandatory &&
|
if (!EHFrameInfo.hasCalls && !UnwindTablesMandatory &&
|
||||||
(!TheFunc->isWeakForLinker() ||
|
(!TheFunc->isWeakForLinker() ||
|
||||||
!MAI->getWeakDefDirective() ||
|
!Asm->MAI->getWeakDefDirective() ||
|
||||||
TLOF.getSupportsWeakOmittedEHFrame())) {
|
TLOF.getSupportsWeakOmittedEHFrame())) {
|
||||||
Asm->OutStreamer.EmitAssignment(EHFrameInfo.FunctionEHSym,
|
Asm->OutStreamer.EmitAssignment(EHFrameInfo.FunctionEHSym,
|
||||||
MCConstantExpr::Create(0, Asm->OutContext));
|
MCConstantExpr::Create(0, Asm->OutContext));
|
||||||
// This name has no connection to the function, so it might get
|
// This name has no connection to the function, so it might get
|
||||||
// dead-stripped when the function is not, erroneously. Prohibit
|
// dead-stripped when the function is not, erroneously. Prohibit
|
||||||
// dead-stripping unconditionally.
|
// dead-stripping unconditionally.
|
||||||
if (MAI->hasNoDeadStrip())
|
if (Asm->MAI->hasNoDeadStrip())
|
||||||
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
||||||
MCSA_NoDeadStrip);
|
MCSA_NoDeadStrip);
|
||||||
} else {
|
} else {
|
||||||
@ -258,7 +261,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
|||||||
// On Darwin the linker honors the alignment of eh_frame, which means it
|
// On Darwin the linker honors the alignment of eh_frame, which means it
|
||||||
// must be 8-byte on 64-bit targets to match what gcc does. Otherwise you
|
// must be 8-byte on 64-bit targets to match what gcc does. Otherwise you
|
||||||
// get holes which confuse readers of eh_frame.
|
// get holes which confuse readers of eh_frame.
|
||||||
Asm->EmitAlignment(TD->getPointerSize() == sizeof(int32_t) ? 2 : 3,
|
Asm->EmitAlignment(Asm->getTargetData().getPointerSize() == 4 ? 2 : 3,
|
||||||
0, 0, false);
|
0, 0, false);
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_end",
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_end",
|
||||||
EHFrameInfo.Number));
|
EHFrameInfo.Number));
|
||||||
@ -269,7 +272,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
|
|||||||
// on unused functions (calling undefined externals) being dead-stripped to
|
// on unused functions (calling undefined externals) being dead-stripped to
|
||||||
// link correctly. Yes, there really is.
|
// link correctly. Yes, there really is.
|
||||||
if (MMI->isUsedFunction(EHFrameInfo.function))
|
if (MMI->isUsedFunction(EHFrameInfo.function))
|
||||||
if (MAI->hasNoDeadStrip())
|
if (Asm->MAI->hasNoDeadStrip())
|
||||||
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
|
||||||
MCSA_NoDeadStrip);
|
MCSA_NoDeadStrip);
|
||||||
}
|
}
|
||||||
@ -472,7 +475,7 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
|
|||||||
bool PreviousIsInvoke = false;
|
bool PreviousIsInvoke = false;
|
||||||
|
|
||||||
// Visit all instructions in order of address.
|
// Visit all instructions in order of address.
|
||||||
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
|
for (MachineFunction::const_iterator I = Asm->MF->begin(), E = Asm->MF->end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end();
|
for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end();
|
||||||
MI != E; ++MI) {
|
MI != E; ++MI) {
|
||||||
@ -503,7 +506,7 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
|
|||||||
// create a call-site entry with no landing pad for the region between the
|
// create a call-site entry with no landing pad for the region between the
|
||||||
// try-ranges.
|
// try-ranges.
|
||||||
if (SawPotentiallyThrowing &&
|
if (SawPotentiallyThrowing &&
|
||||||
MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) {
|
Asm->MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) {
|
||||||
CallSiteEntry Site = { LastLabel, BeginLabel, 0, 0 };
|
CallSiteEntry Site = { LastLabel, BeginLabel, 0, 0 };
|
||||||
CallSites.push_back(Site);
|
CallSites.push_back(Site);
|
||||||
PreviousIsInvoke = false;
|
PreviousIsInvoke = false;
|
||||||
@ -526,7 +529,7 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
|
|||||||
|
|
||||||
// Try to merge with the previous call-site. SJLJ doesn't do this
|
// Try to merge with the previous call-site. SJLJ doesn't do this
|
||||||
if (PreviousIsInvoke &&
|
if (PreviousIsInvoke &&
|
||||||
MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) {
|
Asm->MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) {
|
||||||
CallSiteEntry &Prev = CallSites.back();
|
CallSiteEntry &Prev = CallSites.back();
|
||||||
if (Site.PadLabel == Prev.PadLabel && Site.Action == Prev.Action) {
|
if (Site.PadLabel == Prev.PadLabel && Site.Action == Prev.Action) {
|
||||||
// Extend the range of the previous entry.
|
// Extend the range of the previous entry.
|
||||||
@ -536,7 +539,7 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, create a new call-site.
|
// Otherwise, create a new call-site.
|
||||||
if (MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf)
|
if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf)
|
||||||
CallSites.push_back(Site);
|
CallSites.push_back(Site);
|
||||||
else {
|
else {
|
||||||
// SjLj EH must maintain the call sites in the order assigned
|
// SjLj EH must maintain the call sites in the order assigned
|
||||||
@ -555,7 +558,7 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
|
|||||||
// function may throw, create a call-site entry with no landing pad for the
|
// function may throw, create a call-site entry with no landing pad for the
|
||||||
// region following the try-range.
|
// region following the try-range.
|
||||||
if (SawPotentiallyThrowing &&
|
if (SawPotentiallyThrowing &&
|
||||||
MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) {
|
Asm->MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) {
|
||||||
CallSiteEntry Site = { LastLabel, 0, 0, 0 };
|
CallSiteEntry Site = { LastLabel, 0, 0, 0 };
|
||||||
CallSites.push_back(Site);
|
CallSites.push_back(Site);
|
||||||
}
|
}
|
||||||
@ -623,7 +626,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// Final tallies.
|
// Final tallies.
|
||||||
|
|
||||||
// Call sites.
|
// Call sites.
|
||||||
bool IsSJLJ = MAI->getExceptionHandlingType() == ExceptionHandling::SjLj;
|
bool IsSJLJ = Asm->MAI->getExceptionHandlingType() == ExceptionHandling::SjLj;
|
||||||
bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true;
|
bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true;
|
||||||
|
|
||||||
unsigned CallSiteTableLength;
|
unsigned CallSiteTableLength;
|
||||||
@ -652,7 +655,8 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// For SjLj exceptions, if there is no TypeInfo, then we just explicitly say
|
// For SjLj exceptions, if there is no TypeInfo, then we just explicitly say
|
||||||
// that we're omitting that bit.
|
// that we're omitting that bit.
|
||||||
TTypeEncoding = dwarf::DW_EH_PE_omit;
|
TTypeEncoding = dwarf::DW_EH_PE_omit;
|
||||||
TypeFormatSize = TD->getPointerSize(); // dwarf::DW_EH_PE_absptr
|
// dwarf::DW_EH_PE_absptr
|
||||||
|
TypeFormatSize = Asm->getTargetData().getPointerSize();
|
||||||
} else {
|
} else {
|
||||||
// Okay, we have actual filters or typeinfos to emit. As such, we need to
|
// Okay, we have actual filters or typeinfos to emit. As such, we need to
|
||||||
// pick a type encoding for them. We're about to emit a list of pointers to
|
// pick a type encoding for them. We're about to emit a list of pointers to
|
||||||
@ -692,9 +696,10 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// Emit the LSDA.
|
// Emit the LSDA.
|
||||||
MCSymbol *GCCETSym =
|
MCSymbol *GCCETSym =
|
||||||
Asm->OutContext.GetOrCreateSymbol(Twine("GCC_except_table")+
|
Asm->OutContext.GetOrCreateSymbol(Twine("GCC_except_table")+
|
||||||
Twine(SubprogramCount));
|
Twine(Asm->getFunctionNumber()));
|
||||||
Asm->OutStreamer.EmitLabel(GCCETSym);
|
Asm->OutStreamer.EmitLabel(GCCETSym);
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("exception", SubprogramCount));
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("exception",
|
||||||
|
Asm->getFunctionNumber()));
|
||||||
|
|
||||||
if (IsSJLJ)
|
if (IsSJLJ)
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("_LSDA_",
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("_LSDA_",
|
||||||
@ -767,7 +772,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// DWARF Exception handling
|
// DWARF Exception handling
|
||||||
assert(MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf);
|
assert(Asm->MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf);
|
||||||
|
|
||||||
// The call-site table is a list of all call sites that may throw an
|
// The call-site table is a list of all call sites that may throw an
|
||||||
// exception (including C++ 'throw' statements) in the procedure
|
// exception (including C++ 'throw' statements) in the procedure
|
||||||
@ -798,14 +803,14 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
const CallSiteEntry &S = *I;
|
const CallSiteEntry &S = *I;
|
||||||
|
|
||||||
MCSymbol *EHFuncBeginSym =
|
MCSymbol *EHFuncBeginSym =
|
||||||
Asm->GetTempSymbol("eh_func_begin", SubprogramCount);
|
Asm->GetTempSymbol("eh_func_begin", Asm->getFunctionNumber());
|
||||||
|
|
||||||
MCSymbol *BeginLabel = S.BeginLabel;
|
MCSymbol *BeginLabel = S.BeginLabel;
|
||||||
if (BeginLabel == 0)
|
if (BeginLabel == 0)
|
||||||
BeginLabel = EHFuncBeginSym;
|
BeginLabel = EHFuncBeginSym;
|
||||||
MCSymbol *EndLabel = S.EndLabel;
|
MCSymbol *EndLabel = S.EndLabel;
|
||||||
if (EndLabel == 0)
|
if (EndLabel == 0)
|
||||||
EndLabel = Asm->GetTempSymbol("eh_func_end", SubprogramCount);
|
EndLabel = Asm->GetTempSymbol("eh_func_end", Asm->getFunctionNumber());
|
||||||
|
|
||||||
// Offset of the call site relative to the previous call site, counted in
|
// Offset of the call site relative to the previous call site, counted in
|
||||||
// number of 16-byte bundles. The first call site is counted relative to
|
// number of 16-byte bundles. The first call site is counted relative to
|
||||||
@ -891,7 +896,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
/// EndModule - Emit all exception information that should come after the
|
/// EndModule - Emit all exception information that should come after the
|
||||||
/// content.
|
/// content.
|
||||||
void DwarfException::EndModule() {
|
void DwarfException::EndModule() {
|
||||||
if (MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf)
|
if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!shouldEmitMovesModule && !shouldEmitTableModule)
|
if (!shouldEmitMovesModule && !shouldEmitTableModule)
|
||||||
@ -912,22 +917,22 @@ void DwarfException::EndModule() {
|
|||||||
/// BeginFunction - Gather pre-function exception information. Assumes it's
|
/// BeginFunction - Gather pre-function exception information. Assumes it's
|
||||||
/// being emitted immediately after the function entry point.
|
/// being emitted immediately after the function entry point.
|
||||||
void DwarfException::BeginFunction(const MachineFunction *MF) {
|
void DwarfException::BeginFunction(const MachineFunction *MF) {
|
||||||
if (!MMI || !MAI->doesSupportExceptionHandling()) return;
|
if (!MMI || !Asm->MAI->doesSupportExceptionHandling()) return;
|
||||||
|
|
||||||
TimeRegion Timer(ExceptionTimer);
|
TimeRegion Timer(ExceptionTimer);
|
||||||
this->MF = MF;
|
|
||||||
shouldEmitTable = shouldEmitMoves = false;
|
shouldEmitTable = shouldEmitMoves = false;
|
||||||
|
|
||||||
// If any landing pads survive, we need an EH table.
|
// If any landing pads survive, we need an EH table.
|
||||||
shouldEmitTable = !MMI->getLandingPads().empty();
|
shouldEmitTable = !MMI->getLandingPads().empty();
|
||||||
|
|
||||||
// See if we need frame move info.
|
// See if we need frame move info.
|
||||||
shouldEmitMoves = !MF->getFunction()->doesNotThrow() || UnwindTablesMandatory;
|
shouldEmitMoves =
|
||||||
|
!Asm->MF->getFunction()->doesNotThrow() || UnwindTablesMandatory;
|
||||||
|
|
||||||
if (shouldEmitMoves || shouldEmitTable)
|
if (shouldEmitMoves || shouldEmitTable)
|
||||||
// Assumes in correct section after the entry point.
|
// Assumes in correct section after the entry point.
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
|
||||||
++SubprogramCount));
|
Asm->getFunctionNumber()));
|
||||||
|
|
||||||
shouldEmitTableModule |= shouldEmitTable;
|
shouldEmitTableModule |= shouldEmitTable;
|
||||||
shouldEmitMovesModule |= shouldEmitMoves;
|
shouldEmitMovesModule |= shouldEmitMoves;
|
||||||
@ -939,7 +944,8 @@ void DwarfException::EndFunction() {
|
|||||||
if (!shouldEmitMoves && !shouldEmitTable) return;
|
if (!shouldEmitMoves && !shouldEmitTable) return;
|
||||||
|
|
||||||
TimeRegion Timer(ExceptionTimer);
|
TimeRegion Timer(ExceptionTimer);
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",SubprogramCount));
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_end",
|
||||||
|
Asm->getFunctionNumber()));
|
||||||
|
|
||||||
// Record if this personality index uses a landing pad.
|
// Record if this personality index uses a landing pad.
|
||||||
bool HasLandingPad = !MMI->getLandingPads().empty();
|
bool HasLandingPad = !MMI->getLandingPads().empty();
|
||||||
@ -953,14 +959,15 @@ void DwarfException::EndFunction() {
|
|||||||
|
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
MCSymbol *FunctionEHSym =
|
MCSymbol *FunctionEHSym =
|
||||||
Asm->GetSymbolWithGlobalValueBase(MF->getFunction(), ".eh",
|
Asm->GetSymbolWithGlobalValueBase(Asm->MF->getFunction(), ".eh",
|
||||||
TLOF.isFunctionEHFrameSymbolPrivate());
|
TLOF.isFunctionEHFrameSymbolPrivate());
|
||||||
|
|
||||||
// Save EH frame information
|
// Save EH frame information
|
||||||
EHFrames.push_back(FunctionEHFrameInfo(FunctionEHSym, SubprogramCount,
|
EHFrames.push_back(FunctionEHFrameInfo(FunctionEHSym,
|
||||||
|
Asm->getFunctionNumber(),
|
||||||
MMI->getPersonalityIndex(),
|
MMI->getPersonalityIndex(),
|
||||||
MF->getFrameInfo()->hasCalls(),
|
Asm->MF->getFrameInfo()->hasCalls(),
|
||||||
!MMI->getLandingPads().empty(),
|
!MMI->getLandingPads().empty(),
|
||||||
MMI->getFrameMoves(),
|
MMI->getFrameMoves(),
|
||||||
MF->getFunction()));
|
Asm->MF->getFunction()));
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
#ifndef LLVM_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
|
#ifndef LLVM_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
|
||||||
#define LLVM_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
|
#define LLVM_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
|
||||||
|
|
||||||
#include "DIE.h"
|
|
||||||
#include "DwarfPrinter.h"
|
|
||||||
#include "llvm/CodeGen/AsmPrinter.h"
|
#include "llvm/CodeGen/AsmPrinter.h"
|
||||||
#include "llvm/ADT/DenseMap.h"
|
#include "llvm/ADT/DenseMap.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -32,7 +30,14 @@ class raw_ostream;
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// DwarfException - Emits Dwarf exception handling directives.
|
/// DwarfException - Emits Dwarf exception handling directives.
|
||||||
///
|
///
|
||||||
class DwarfException : public DwarfPrinter {
|
class DwarfException {
|
||||||
|
/// Asm - Target of Dwarf emission.
|
||||||
|
AsmPrinter *Asm;
|
||||||
|
public:
|
||||||
|
/// MMI - Collected machine module information.
|
||||||
|
MachineModuleInfo *MMI;
|
||||||
|
private:
|
||||||
|
|
||||||
struct FunctionEHFrameInfo {
|
struct FunctionEHFrameInfo {
|
||||||
MCSymbol *FunctionEHSym; // L_foo.eh
|
MCSymbol *FunctionEHSym; // L_foo.eh
|
||||||
unsigned Number;
|
unsigned Number;
|
||||||
@ -169,13 +174,6 @@ public:
|
|||||||
DwarfException(AsmPrinter *A);
|
DwarfException(AsmPrinter *A);
|
||||||
virtual ~DwarfException();
|
virtual ~DwarfException();
|
||||||
|
|
||||||
/// BeginModule - Emit all exception information that should come prior to the
|
|
||||||
/// content.
|
|
||||||
void BeginModule(Module *m) {
|
|
||||||
this->M = m;
|
|
||||||
this->MMI = Asm->MMI;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EndModule - Emit all exception information that should come after the
|
/// EndModule - Emit all exception information that should come after the
|
||||||
/// content.
|
/// content.
|
||||||
void EndModule();
|
void EndModule();
|
||||||
|
@ -39,7 +39,6 @@ DwarfWriter::~DwarfWriter() {
|
|||||||
void DwarfWriter::BeginModule(Module *M, AsmPrinter *A) {
|
void DwarfWriter::BeginModule(Module *M, AsmPrinter *A) {
|
||||||
DE = new DwarfException(A);
|
DE = new DwarfException(A);
|
||||||
DD = new DwarfDebug(A);
|
DD = new DwarfDebug(A);
|
||||||
DE->BeginModule(M);
|
|
||||||
DD->beginModule(M);
|
DD->beginModule(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +64,7 @@ void DwarfWriter::EndFunction(const MachineFunction *MF) {
|
|||||||
DD->endFunction(MF);
|
DD->endFunction(MF);
|
||||||
DE->EndFunction();
|
DE->EndFunction();
|
||||||
|
|
||||||
if (MachineModuleInfo *MMI = DE->getMMI())
|
if (MachineModuleInfo *MMI = DE->MMI)
|
||||||
// Clear function debug information.
|
// Clear function debug information.
|
||||||
MMI->EndFunction();
|
MMI->EndFunction();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user