[llvm-commits] [llvm] r130437 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h include/llvm/MC/MCAsmInfoDarwin.h lib/MC/MCAsmInfo.cpp lib/MC/MCAsmInfoDarwin.cpp lib/MC/MCDwarf.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu Apr 28 14:04:39 PDT 2011
Author: rafael
Date: Thu Apr 28 16:04:39 2011
New Revision: 130437
URL: http://llvm.org/viewvc/llvm-project?rev=130437&view=rev
Log:
Add the getExprForFDESymbol method that responsible for computing the
expressions used in the FDE to refer to symbols.
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfo.h
llvm/trunk/include/llvm/MC/MCAsmInfoDarwin.h
llvm/trunk/lib/MC/MCAsmInfo.cpp
llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
llvm/trunk/lib/MC/MCDwarf.cpp
Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=130437&r1=130436&r2=130437&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Thu Apr 28 16:04:39 2011
@@ -328,6 +328,9 @@
getExprForPersonalitySymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const;
+ virtual const MCExpr *
+ getExprForFDESymbol(const MCSymbol *Sym, MCStreamer &Streamer) const;
+
bool usesSunStyleELFSectionSwitchSyntax() const {
return SunStyleELFSectionSwitchSyntax;
}
Modified: llvm/trunk/include/llvm/MC/MCAsmInfoDarwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfoDarwin.h?rev=130437&r1=130436&r2=130437&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfoDarwin.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfoDarwin.h Thu Apr 28 16:04:39 2011
@@ -26,8 +26,7 @@
struct MCAsmInfoDarwin : public MCAsmInfo {
explicit MCAsmInfoDarwin();
virtual const MCExpr *
- getExprForPersonalitySymbol(const MCSymbol *Sym,
- MCStreamer &Streamer) const;
+ getExprForFDESymbol(const MCSymbol *Sym, MCStreamer &Streamer) const;
};
}
Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=130437&r1=130436&r2=130437&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Thu Apr 28 16:04:39 2011
@@ -112,5 +112,11 @@
const MCExpr *
MCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const {
+ return getExprForFDESymbol(Sym, Streamer);
+}
+
+const MCExpr *
+MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
+ MCStreamer &Streamer) const {
return MCSymbolRefExpr::Create(Sym, Streamer.getContext());
}
Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=130437&r1=130436&r2=130437&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Thu Apr 28 16:04:39 2011
@@ -61,8 +61,8 @@
}
const MCExpr *
-MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym,
- MCStreamer &Streamer) const {
+MCAsmInfoDarwin::getExprForFDESymbol(const MCSymbol *Sym,
+ MCStreamer &Streamer) const {
MCContext &Context = Streamer.getContext();
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context);
MCSymbol *PCSym = Context.CreateTempSymbol();
Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=130437&r1=130436&r2=130437&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Thu Apr 28 16:04:39 2011
@@ -465,19 +465,16 @@
static void EmitSymbol(MCStreamer &streamer, const MCSymbol &symbol,
unsigned symbolEncoding) {
+ MCContext &context = streamer.getContext();
+ const MCAsmInfo &asmInfo = context.getAsmInfo();
+ const MCExpr *v = asmInfo.getExprForFDESymbol(&symbol,
+ streamer);
unsigned size = getSizeForEncoding(streamer, symbolEncoding);
unsigned application = symbolEncoding & 0x70;
- switch (application) {
- default:
- assert(0 && "Unknown Encoding");
- break;
- case 0:
- streamer.EmitSymbolValue(&symbol, size);
- break;
- case dwarf::DW_EH_PE_pcrel:
- streamer.EmitPCRelSymbolValue(&symbol, size);
- break;
- }
+ if (isa<MCSymbolRefExpr>(v) && application == dwarf::DW_EH_PE_pcrel)
+ streamer.EmitPCRelValue(v, size);
+ else
+ streamer.EmitAbsValue(v, size);
}
static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
@@ -756,7 +753,7 @@
unsigned size = getSizeForEncoding(streamer, fdeEncoding);
// PC Begin
- streamer.EmitPCRelSymbolValue(frame.Begin, size);
+ EmitSymbol(streamer, *frame.Begin, fdeEncoding);
// PC Range
const MCExpr *Range = MakeStartMinusEndExpr(streamer, *frame.Begin,
More information about the llvm-commits
mailing list