[llvm] r200376 - [Sparc] Use %r_disp32 for pc_rel entries in FDE as well.
Venkatraman Govindaraju
venkatra at cs.wisc.edu
Tue Jan 28 22:59:20 PST 2014
Author: venkatra
Date: Wed Jan 29 00:59:20 2014
New Revision: 200376
URL: http://llvm.org/viewvc/llvm-project?rev=200376&view=rev
Log:
[Sparc] Use %r_disp32 for pc_rel entries in FDE as well.
This makes MCAsmInfo::getExprForFDESymbol() a virtual function and overrides it in SparcMCAsmInfo.
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfo.h
llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
llvm/trunk/test/CodeGen/SPARC/exception.ll
Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=200376&r1=200375&r2=200376&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Wed Jan 29 00:59:20 2014
@@ -364,7 +364,7 @@ namespace llvm {
unsigned Encoding,
MCStreamer &Streamer) const;
- const MCExpr *
+ virtual const MCExpr *
getExprForFDESymbol(const MCSymbol *Sym,
unsigned Encoding,
MCStreamer &Streamer) const;
Modified: llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp?rev=200376&r1=200375&r2=200376&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp Wed Jan 29 00:59:20 2014
@@ -56,3 +56,15 @@ SparcELFMCAsmInfo::getExprForPersonality
return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
}
+
+const MCExpr*
+SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
+ unsigned Encoding,
+ MCStreamer &Streamer) const {
+ if (Encoding & dwarf::DW_EH_PE_pcrel) {
+ MCContext &Ctx = Streamer.getContext();
+ return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
+ MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
+ }
+ return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
+}
Modified: llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h?rev=200376&r1=200375&r2=200376&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h (original)
+++ llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.h Wed Jan 29 00:59:20 2014
@@ -26,6 +26,10 @@ public:
virtual const MCExpr* getExprForPersonalitySymbol(const MCSymbol *Sym,
unsigned Encoding,
MCStreamer &Streamer) const;
+ virtual const MCExpr* getExprForFDESymbol(const MCSymbol *Sym,
+ unsigned Encoding,
+ MCStreamer &Streamer) const;
+
};
} // namespace llvm
Modified: llvm/trunk/test/CodeGen/SPARC/exception.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/exception.ll?rev=200376&r1=200375&r2=200376&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SPARC/exception.ll (original)
+++ llvm/trunk/test/CodeGen/SPARC/exception.ll Wed Jan 29 00:59:20 2014
@@ -57,6 +57,7 @@
; V8PIC_NOCFI: .section .eh_frame
; V8PIC_NOCFI-NOT: .section
; V8PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
+; V8PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
; V9ABS-LABEL: main:
@@ -94,6 +95,7 @@
; V9PIC_NOCFI: .section .eh_frame
; V9PIC_NOCFI-NOT: .section
; V9PIC_NOCFI: .word %r_disp32(DW.ref.__gxx_personality_v0)
+; V9PIC_NOCFI: .word %r_disp32(.Ltmp{{.+}}) ! FDE initial location
define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 {
entry:
More information about the llvm-commits
mailing list