[llvm] r232475 - Move the EH symbol to the asm printer and use it for the SJLJ case too.
Rafael Espindola
rafael.espindola at gmail.com
Tue Mar 17 06:57:49 PDT 2015
Author: rafael
Date: Tue Mar 17 08:57:48 2015
New Revision: 232475
URL: http://llvm.org/viewvc/llvm-project?rev=232475&view=rev
Log:
Move the EH symbol to the asm printer and use it for the SJLJ case too.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.h
llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Mar 17 08:57:48 2015
@@ -108,6 +108,7 @@ public:
private:
MCSymbol *CurrentFnBegin;
MCSymbol *CurrentFnEnd;
+ MCSymbol *CurExceptionSym;
// The garbage collection metadata printer table.
void *GCMetadataPrinters; // Really a DenseMap.
@@ -154,6 +155,7 @@ public:
MCSymbol *getFunctionBegin() const { return CurrentFnBegin; }
MCSymbol *getFunctionEnd() const { return CurrentFnEnd; }
+ MCSymbol *getCurExceptionSym();
/// Return information about object file lowering.
const TargetLoweringObjectFile &getObjFileLowering() const;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp Tue Mar 17 08:57:48 2015
@@ -53,8 +53,6 @@ void ARMException::endModule() {
}
void ARMException::beginFunction(const MachineFunction *MF) {
- DwarfCFIExceptionBase::beginFunction(MF);
-
if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
getTargetStreamer().emitFnStart();
// See if we need call frame info.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Mar 17 08:57:48 2015
@@ -108,7 +108,7 @@ AsmPrinter::AsmPrinter(TargetMachine &tm
MMI = nullptr;
LI = nullptr;
MF = nullptr;
- CurrentFnSym = CurrentFnSymForSize = nullptr;
+ CurExceptionSym = CurrentFnSym = CurrentFnSymForSize = nullptr;
CurrentFnBegin = nullptr;
CurrentFnEnd = nullptr;
GCMetadataPrinters = nullptr;
@@ -1129,12 +1129,19 @@ bool AsmPrinter::doFinalization(Module &
return false;
}
+MCSymbol *AsmPrinter::getCurExceptionSym() {
+ if (!CurExceptionSym)
+ CurExceptionSym = createTempSymbol("exception", getFunctionNumber());
+ return CurExceptionSym;
+}
+
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
this->MF = &MF;
// Get the function symbol.
CurrentFnSym = getSymbol(MF.getFunction());
CurrentFnSymForSize = CurrentFnSym;
CurrentFnBegin = nullptr;
+ CurExceptionSym = nullptr;
bool NeedsLocalForSize = MAI->needsLocalForSize();
if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() ||
NeedsLocalForSize) {
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp Tue Mar 17 08:57:48 2015
@@ -88,8 +88,6 @@ void DwarfCFIException::endModule() {
}
void DwarfCFIException::beginFunction(const MachineFunction *MF) {
- DwarfCFIExceptionBase::beginFunction(MF);
-
shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA = false;
// If any landing pads survive, we need an EH table.
@@ -133,7 +131,7 @@ void DwarfCFIException::beginFunction(co
if (!shouldEmitLSDA)
return;
- Asm->OutStreamer.EmitCFILsda(getCurExceptionSym(), LSDAEncoding);
+ Asm->OutStreamer.EmitCFILsda(Asm->getCurExceptionSym(), LSDAEncoding);
}
/// endFunction - Gather and emit post-function exception information.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp Tue Mar 17 08:57:48 2015
@@ -25,22 +25,10 @@
using namespace llvm;
-EHStreamer::EHStreamer(AsmPrinter *A)
- : CurExceptionSym(nullptr), Asm(A), MMI(Asm->MMI) {}
+EHStreamer::EHStreamer(AsmPrinter *A) : 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) {
@@ -448,11 +436,7 @@ void EHStreamer::emitExceptionTable() {
Asm->OutContext.GetOrCreateSymbol(Twine("GCC_except_table")+
Twine(Asm->getFunctionNumber()));
Asm->OutStreamer.EmitLabel(GCCETSym);
- Asm->OutStreamer.EmitLabel(getCurExceptionSym());
-
- if (IsSJLJ)
- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("_LSDA_",
- Asm->getFunctionNumber()));
+ Asm->OutStreamer.EmitLabel(Asm->getCurExceptionSym());
// Emit the LSDA header.
Asm->EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.h?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.h Tue Mar 17 08:57:48 2015
@@ -31,8 +31,6 @@ class SmallVectorImpl;
/// Emits exception handling directives.
class EHStreamer : public AsmPrinterHandler {
- MCSymbol *CurExceptionSym;
-
protected:
/// Target of directive emission.
AsmPrinter *Asm;
@@ -127,9 +125,6 @@ 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 {}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/Win64Exception.cpp Tue Mar 17 08:57:48 2015
@@ -49,8 +49,6 @@ void Win64Exception::endModule() {
}
void Win64Exception::beginFunction(const MachineFunction *MF) {
- EHStreamer::beginFunction(MF);
-
shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA = false;
// If any landing pads survive, we need an EH table.
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Tue Mar 17 08:57:48 2015
@@ -960,10 +960,7 @@ EmitMachineConstantPoolValue(MachineCons
MCSymbol *MCSym;
if (ACPV->isLSDA()) {
- SmallString<128> Str;
- raw_svector_ostream OS(Str);
- OS << DL->getPrivateGlobalPrefix() << "_LSDA_" << getFunctionNumber();
- MCSym = OutContext.GetOrCreateSymbol(OS.str());
+ MCSym = getCurExceptionSym();
} else if (ACPV->isBlockAddress()) {
const BlockAddress *BA =
cast<ARMConstantPoolConstant>(ACPV)->getBlockAddress();
Modified: llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll?rev=232475&r1=232474&r2=232475&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2009-08-31-LSDA-Name.ll Tue Mar 17 08:57:48 2015
@@ -1,7 +1,9 @@
; RUN: llc < %s -mtriple=arm-apple-darwin9 -march=arm | FileCheck %s
-; CHECK: L_LSDA_0:
-
+; CHECK: .cfi_lsda 16, [[LABEL:.*]]
+; CHECK: .long [[LABEL]]-
+; CHECK: [[LABEL]]:
+; CHECK: .byte 255 @ @LPStart Encoding = omit
%struct.A = type { i32* }
More information about the llvm-commits
mailing list