mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Change DwarfCFIException's member variables to track what it actually
emmits: .cfi_personality, .cfi_lsda and the moves. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130503 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d49ffe8284
commit
7b11a4cbdc
@ -41,7 +41,7 @@ using namespace llvm;
|
|||||||
|
|
||||||
DwarfCFIException::DwarfCFIException(AsmPrinter *A)
|
DwarfCFIException::DwarfCFIException(AsmPrinter *A)
|
||||||
: DwarfException(A),
|
: DwarfException(A),
|
||||||
shouldEmitTable(false), shouldEmitMoves(false), shouldEmitTableModule(false)
|
shouldEmitPersonality(false), shouldEmitLSDA(false), shouldEmitMoves(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
DwarfCFIException::~DwarfCFIException() {}
|
DwarfCFIException::~DwarfCFIException() {}
|
||||||
@ -52,9 +52,6 @@ void DwarfCFIException::EndModule() {
|
|||||||
if (!Asm->MAI->isExceptionHandlingDwarf())
|
if (!Asm->MAI->isExceptionHandlingDwarf())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!shouldEmitTableModule)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
||||||
|
|
||||||
@ -64,7 +61,9 @@ void DwarfCFIException::EndModule() {
|
|||||||
// Emit references to all used personality functions
|
// Emit references to all used personality functions
|
||||||
const std::vector<const Function*> &Personalities = MMI->getPersonalities();
|
const std::vector<const Function*> &Personalities = MMI->getPersonalities();
|
||||||
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
||||||
const MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
|
if (!Personalities[i])
|
||||||
|
continue;
|
||||||
|
MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
|
||||||
TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
|
TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,50 +71,54 @@ void DwarfCFIException::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 DwarfCFIException::BeginFunction(const MachineFunction *MF) {
|
void DwarfCFIException::BeginFunction(const MachineFunction *MF) {
|
||||||
shouldEmitTable = shouldEmitMoves = false;
|
shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA = 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();
|
bool hasLandingPads = !MMI->getLandingPads().empty();
|
||||||
|
|
||||||
// See if we need frame move info.
|
// See if we need frame move info.
|
||||||
shouldEmitMoves = Asm->needsCFIMoves();
|
shouldEmitMoves = Asm->needsCFIMoves();
|
||||||
|
|
||||||
if (shouldEmitMoves || shouldEmitTable)
|
|
||||||
// Assumes in correct section after the entry point.
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
|
|
||||||
Asm->getFunctionNumber()));
|
|
||||||
|
|
||||||
shouldEmitTableModule |= shouldEmitTable;
|
|
||||||
|
|
||||||
if (shouldEmitMoves || shouldEmitTable)
|
|
||||||
Asm->OutStreamer.EmitCFIStartProc();
|
|
||||||
|
|
||||||
if (!shouldEmitTable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
|
|
||||||
// Provide LSDA information.
|
|
||||||
unsigned LSDAEncoding = TLOF.getLSDAEncoding();
|
|
||||||
if (LSDAEncoding != dwarf::DW_EH_PE_omit)
|
|
||||||
Asm->OutStreamer.EmitCFILsda(Asm->GetTempSymbol("exception",
|
|
||||||
Asm->getFunctionNumber()),
|
|
||||||
LSDAEncoding);
|
|
||||||
|
|
||||||
// Indicate personality routine, if any.
|
|
||||||
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
||||||
const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
|
const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
|
||||||
if (PerEncoding == dwarf::DW_EH_PE_omit || !Per)
|
|
||||||
|
shouldEmitPersonality = hasLandingPads &&
|
||||||
|
PerEncoding != dwarf::DW_EH_PE_omit && Per;
|
||||||
|
|
||||||
|
unsigned LSDAEncoding = TLOF.getLSDAEncoding();
|
||||||
|
shouldEmitLSDA = shouldEmitPersonality &&
|
||||||
|
LSDAEncoding != dwarf::DW_EH_PE_omit;
|
||||||
|
|
||||||
|
if (!shouldEmitPersonality && !shouldEmitMoves)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Asm->OutStreamer.EmitCFIStartProc();
|
||||||
|
|
||||||
|
// Indicate personality routine, if any.
|
||||||
|
if (!shouldEmitPersonality)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, Asm->Mang, MMI);
|
const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, Asm->Mang, MMI);
|
||||||
Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
|
Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
|
||||||
|
|
||||||
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
|
||||||
|
Asm->getFunctionNumber()));
|
||||||
|
|
||||||
|
// Provide LSDA information.
|
||||||
|
if (!shouldEmitLSDA)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Asm->OutStreamer.EmitCFILsda(Asm->GetTempSymbol("exception",
|
||||||
|
Asm->getFunctionNumber()),
|
||||||
|
LSDAEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EndFunction - Gather and emit post-function exception information.
|
/// EndFunction - Gather and emit post-function exception information.
|
||||||
///
|
///
|
||||||
void DwarfCFIException::EndFunction() {
|
void DwarfCFIException::EndFunction() {
|
||||||
if (!shouldEmitMoves && !shouldEmitTable) return;
|
if (!shouldEmitPersonality && !shouldEmitMoves)
|
||||||
|
return;
|
||||||
|
|
||||||
Asm->OutStreamer.EmitCFIEndProc();
|
Asm->OutStreamer.EmitCFIEndProc();
|
||||||
|
|
||||||
@ -125,6 +128,6 @@ void DwarfCFIException::EndFunction() {
|
|||||||
// Map all labels and get rid of any dead landing pads.
|
// Map all labels and get rid of any dead landing pads.
|
||||||
MMI->TidyLandingPads();
|
MMI->TidyLandingPads();
|
||||||
|
|
||||||
if (shouldEmitTable)
|
if (shouldEmitPersonality)
|
||||||
EmitExceptionTable();
|
EmitExceptionTable();
|
||||||
}
|
}
|
||||||
|
@ -140,17 +140,18 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class DwarfCFIException : public DwarfException {
|
class DwarfCFIException : public DwarfException {
|
||||||
/// shouldEmitTable - Per-function flag to indicate if EH tables should
|
/// shouldEmitPersonality - Per-function flag to indicate if .cfi_personality
|
||||||
/// be emitted.
|
/// should be emitted.
|
||||||
bool shouldEmitTable;
|
bool shouldEmitPersonality;
|
||||||
|
|
||||||
|
/// shouldEmitLSDA - Per-function flag to indicate if .cfi_lsda
|
||||||
|
/// should be emitted.
|
||||||
|
bool shouldEmitLSDA;
|
||||||
|
|
||||||
/// shouldEmitMoves - Per-function flag to indicate if frame moves info
|
/// shouldEmitMoves - Per-function flag to indicate if frame moves info
|
||||||
/// should be emitted.
|
/// should be emitted.
|
||||||
bool shouldEmitMoves;
|
bool shouldEmitMoves;
|
||||||
|
|
||||||
/// shouldEmitTableModule - Per-module flag to indicate if EH tables
|
|
||||||
/// should be emitted.
|
|
||||||
bool shouldEmitTableModule;
|
|
||||||
public:
|
public:
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Main entry points.
|
// Main entry points.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -o - | FileCheck %s
|
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -o - | FileCheck %s
|
||||||
|
|
||||||
; CHECK: .cfi_lsda 0, .Lexception0
|
|
||||||
; CHECK: .cfi_personality 0, __gnat_eh_personality
|
; CHECK: .cfi_personality 0, __gnat_eh_personality
|
||||||
|
; CHECK: .cfi_lsda 0, .Lexception0
|
||||||
|
|
||||||
@error = external global i8 ; <i8*> [#uses=2]
|
@error = external global i8 ; <i8*> [#uses=2]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user