[llvm] r180171 - Align the __LD,__compact_unwind section.
Bill Wendling
isanbard at gmail.com
Tue Apr 23 20:11:14 PDT 2013
Author: void
Date: Tue Apr 23 22:11:14 2013
New Revision: 180171
URL: http://llvm.org/viewvc/llvm-project?rev=180171&view=rev
Log:
Align the __LD,__compact_unwind section.
I know what would be cool! We should align the compact unwind section because
aligned data access is faster.
<rdar://problem/13723271>
Modified:
llvm/trunk/lib/MC/MCDwarf.cpp
Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=180171&r1=180170&r2=180171&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Tue Apr 23 22:11:14 2013
@@ -1177,8 +1177,6 @@ void FrameEmitterImpl::EmitCompactUnwind
if (!DwarfEHFrameOnly && Frame.Lsda)
Encoding |= 0x40000000;
- Streamer.SwitchSection(MOFI->getCompactUnwindSection());
-
// Range Start
unsigned FDEEncoding = MOFI->getFDEEncoding(UsingCFI);
unsigned Size = getSizeForEncoding(Streamer, FDEEncoding);
@@ -1421,7 +1419,6 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCSt
}
// Call Frame Instructions
-
EmitCFIInstructions(streamer, frame.Instructions, frame.Begin);
// Padding
@@ -1482,11 +1479,23 @@ void MCDwarfFrameEmitter::Emit(MCStreame
ArrayRef<MCDwarfFrameInfo> FrameArray = Streamer.getFrameInfos();
// Emit the compact unwind info if available.
- if (IsEH && MOFI->getCompactUnwindSection())
- for (unsigned i = 0, n = Streamer.getNumFrameInfos(); i < n; ++i) {
- const MCDwarfFrameInfo &Frame = Streamer.getFrameInfo(i);
- Emitter.EmitCompactUnwind(Streamer, Frame);
+ if (IsEH && MOFI->getCompactUnwindSection()) {
+ unsigned NumFrameInfos = Streamer.getNumFrameInfos();
+ bool SectionEmitted = false;
+
+ if (NumFrameInfos) {
+ for (unsigned i = 0; i < NumFrameInfos; ++i) {
+ const MCDwarfFrameInfo &Frame = Streamer.getFrameInfo(i);
+ if (Frame.CompactUnwindEncoding == 0) continue;
+ if (!SectionEmitted) {
+ Streamer.SwitchSection(MOFI->getCompactUnwindSection());
+ Streamer.EmitValueToAlignment(Context.getAsmInfo().getPointerSize());
+ SectionEmitted = true;
+ }
+ Emitter.EmitCompactUnwind(Streamer, Frame);
+ }
}
+ }
const MCSection &Section = IsEH ? *MOFI->getEHFrameSection() :
*MOFI->getDwarfFrameSection();
More information about the llvm-commits
mailing list