mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-23 20:29:30 +00:00
Replace a use of GetTempSymbol with createTempSymbol.
This is cleaner and avoids a crash in a corner case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232471 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
06c5d245a2
commit
4d3df54336
@ -52,9 +52,9 @@ void ARMException::endModule() {
|
||||
Asm->OutStreamer.EmitCFISections(false, true);
|
||||
}
|
||||
|
||||
/// beginFunction - Gather pre-function exception information. Assumes it's
|
||||
/// being emitted immediately after the function entry point.
|
||||
void ARMException::beginFunction(const MachineFunction *MF) {
|
||||
DwarfCFIExceptionBase::beginFunction(MF);
|
||||
|
||||
if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
|
||||
getTargetStreamer().emitFnStart();
|
||||
// See if we need call frame info.
|
||||
|
@ -87,9 +87,9 @@ void DwarfCFIException::endModule() {
|
||||
}
|
||||
}
|
||||
|
||||
/// beginFunction - Gather pre-function exception information. Assumes it's
|
||||
/// being emitted immediately after the function entry point.
|
||||
void DwarfCFIException::beginFunction(const MachineFunction *MF) {
|
||||
DwarfCFIExceptionBase::beginFunction(MF);
|
||||
|
||||
shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA = false;
|
||||
|
||||
// If any landing pads survive, we need an EH table.
|
||||
@ -133,9 +133,7 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) {
|
||||
if (!shouldEmitLSDA)
|
||||
return;
|
||||
|
||||
Asm->OutStreamer.EmitCFILsda(Asm->GetTempSymbol("exception",
|
||||
Asm->getFunctionNumber()),
|
||||
LSDAEncoding);
|
||||
Asm->OutStreamer.EmitCFILsda(getCurExceptionSym(), LSDAEncoding);
|
||||
}
|
||||
|
||||
/// endFunction - Gather and emit post-function exception information.
|
||||
|
@ -25,10 +25,22 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
EHStreamer::EHStreamer(AsmPrinter *A) : Asm(A), MMI(Asm->MMI) {}
|
||||
EHStreamer::EHStreamer(AsmPrinter *A)
|
||||
: CurExceptionSym(nullptr), Asm(A), MMI(Asm->MMI) {}
|
||||
|
||||
EHStreamer::~EHStreamer() {}
|
||||
|
||||
MCSymbol *EHStreamer::getCurExceptionSym() {
|
||||
if (!CurExceptionSym)
|
||||
CurExceptionSym = Asm->OutContext.createTempSymbol(
|
||||
"exception" + Twine(Asm->getFunctionNumber()));
|
||||
return CurExceptionSym;
|
||||
}
|
||||
|
||||
void EHStreamer::beginFunction(const MachineFunction *MF) {
|
||||
CurExceptionSym = nullptr;
|
||||
}
|
||||
|
||||
/// How many leading type ids two landing pads have in common.
|
||||
unsigned EHStreamer::sharedTypeIDs(const LandingPadInfo *L,
|
||||
const LandingPadInfo *R) {
|
||||
@ -436,8 +448,7 @@ void EHStreamer::emitExceptionTable() {
|
||||
Asm->OutContext.GetOrCreateSymbol(Twine("GCC_except_table")+
|
||||
Twine(Asm->getFunctionNumber()));
|
||||
Asm->OutStreamer.EmitLabel(GCCETSym);
|
||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("exception",
|
||||
Asm->getFunctionNumber()));
|
||||
Asm->OutStreamer.EmitLabel(getCurExceptionSym());
|
||||
|
||||
if (IsSJLJ)
|
||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("_LSDA_",
|
||||
|
@ -31,6 +31,8 @@ class SmallVectorImpl;
|
||||
|
||||
/// Emits exception handling directives.
|
||||
class EHStreamer : public AsmPrinterHandler {
|
||||
MCSymbol *CurExceptionSym;
|
||||
|
||||
protected:
|
||||
/// Target of directive emission.
|
||||
AsmPrinter *Asm;
|
||||
@ -125,6 +127,9 @@ public:
|
||||
EHStreamer(AsmPrinter *A);
|
||||
virtual ~EHStreamer();
|
||||
|
||||
MCSymbol *getCurExceptionSym();
|
||||
void beginFunction(const MachineFunction *MF) override;
|
||||
|
||||
// Unused.
|
||||
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
|
||||
void beginInstruction(const MachineInstr *MI) override {}
|
||||
|
@ -48,9 +48,9 @@ Win64Exception::~Win64Exception() {}
|
||||
void Win64Exception::endModule() {
|
||||
}
|
||||
|
||||
/// beginFunction - Gather pre-function exception information. Assumes it's
|
||||
/// being emitted immediately after the function entry point.
|
||||
void Win64Exception::beginFunction(const MachineFunction *MF) {
|
||||
EHStreamer::beginFunction(MF);
|
||||
|
||||
shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA = false;
|
||||
|
||||
// If any landing pads survive, we need an EH table.
|
||||
|
23
test/CodeGen/X86/exception-label.ll
Normal file
23
test/CodeGen/X86/exception-label.ll
Normal file
@ -0,0 +1,23 @@
|
||||
; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s
|
||||
|
||||
; Test that we can handle .Lexception0 being defined. We used to crash.
|
||||
|
||||
; CHECK: .cfi_lsda 3, [[LABEL:.*]]
|
||||
; CHECK: [[LABEL]]:
|
||||
; CHECK-NEXT: .byte 255 # @LPStart Encoding = omit
|
||||
|
||||
declare void @g()
|
||||
|
||||
define void @f() {
|
||||
bb0:
|
||||
call void asm ".Lexception0:", ""()
|
||||
invoke void @g()
|
||||
to label %bb2 unwind label %bb1
|
||||
bb1:
|
||||
landingpad { i8*, i32 } personality i8* bitcast (void ()* @g to i8*)
|
||||
catch i8* null
|
||||
br label %bb2
|
||||
|
||||
bb2:
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user