LICM pass now understands invariant load metadata. Nothing generates this yet so...
[oota-llvm.git] / lib / MC / MCDwarf.cpp
index 06ce502d572aef2a8b820eb75dc3a5e38b45c31d..49828080e01e1fb208accdbf6be6d8c88e2377a6 100644 (file)
@@ -21,7 +21,6 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 using namespace llvm;
 
@@ -738,8 +737,8 @@ bool FrameEmitterImpl::EmitCompactUnwind(MCStreamer &Streamer,
 
   // Compact Encoding
   Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_udata4);
-  if (VerboseAsm) Streamer.AddComment(Twine("Compact Unwind Encoding: 0x") +
-                                      Twine(llvm::utohexstr(Encoding)));
+  if (VerboseAsm) Streamer.AddComment("Compact Unwind Encoding: 0x" +
+                                      Twine::utohexstr(Encoding));
   Streamer.EmitIntValue(Encoding, Size);
 
 
@@ -895,7 +894,7 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer,
   const MCObjectFileInfo *MOFI = context.getObjectFileInfo();
   bool verboseAsm = streamer.isVerboseAsm();
 
-  if (!MOFI->isFunctionEHFrameSymbolPrivate() && IsEH) {
+  if (IsEH && frame.Function && !MOFI->isFunctionEHFrameSymbolPrivate()) {
     MCSymbol *EHSym =
       context.GetOrCreateSymbol(frame.Function->getName() + Twine(".eh"));
     streamer.EmitEHSymAttributes(frame.Function, EHSym);
@@ -1013,24 +1012,18 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
   MCObjectFileInfo *MOFI =
     const_cast<MCObjectFileInfo*>(Context.getObjectFileInfo());
   FrameEmitterImpl Emitter(UsingCFI, IsEH);
-  SmallVector<MCDwarfFrameInfo, 8> RequiresFDE;
-  ArrayRef<MCDwarfFrameInfo> FrameArray;
+  ArrayRef<MCDwarfFrameInfo> FrameArray = Streamer.getFrameInfos();
 
-  if (IsEH && MOFI->getCompactUnwindSection()) {
+  // Emit the compact unwind info if available.
+  // FIXME: This emits both the compact unwind and the old CIE/FDE
+  //        information. Only one of those is needed.
+  if (IsEH && MOFI->getCompactUnwindSection())
     for (unsigned i = 0, n = Streamer.getNumFrameInfos(); i < n; ++i) {
       const MCDwarfFrameInfo &Frame = Streamer.getFrameInfo(i);
-      if (!Frame.CompactUnwindEncoding ||
-          !Emitter.EmitCompactUnwind(Streamer, Frame))
-        RequiresFDE.push_back(Streamer.getFrameInfo(i));
+      if (!Frame.CompactUnwindEncoding)
+        Emitter.EmitCompactUnwind(Streamer, Frame);
     }
 
-    // Early exit if we don't need to emit FDEs.
-    if (RequiresFDE.empty()) return;
-    FrameArray = RequiresFDE;
-  } else {
-    FrameArray = Streamer.getFrameInfos();
-  }
-
   const MCSection &Section = IsEH ? *MOFI->getEHFrameSection() :
                                     *MOFI->getDwarfFrameSection();
   Streamer.SwitchSection(&Section);