[llvm-commits] [llvm] r131791 - in /llvm/trunk: include/llvm/MC/MCWin64EH.h lib/MC/MCStreamer.cpp

Charles Davis cdavis at mines.edu
Sat May 21 08:57:50 PDT 2011


Author: cdavis
Date: Sat May 21 10:57:49 2011
New Revision: 131791

URL: http://llvm.org/viewvc/llvm-project?rev=131791&view=rev
Log:
A handler for a function in the Win64 EH scheme can be both an unwind handler
and an exception handler. Handle that case.

Also, add an 'Emitted' member to the MCWin64EHUnwindInfo struct. It will be
needed later.

Modified:
    llvm/trunk/include/llvm/MC/MCWin64EH.h
    llvm/trunk/lib/MC/MCStreamer.cpp

Modified: llvm/trunk/include/llvm/MC/MCWin64EH.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCWin64EH.h?rev=131791&r1=131790&r2=131791&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCWin64EH.h (original)
+++ llvm/trunk/include/llvm/MC/MCWin64EH.h Sat May 21 10:57:49 2011
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file contains the declaration of the MCDwarfFile to support the dwarf
-// .file directive and the .loc directive.
+// This file contains declarations to support the Win64 Exception Handling
+// scheme in MC.
 //
 //===----------------------------------------------------------------------===//
 
@@ -59,26 +59,29 @@
 
   struct MCWin64EHUnwindInfo {
     MCWin64EHUnwindInfo() : Begin(0), End(0), ExceptionHandler(0),
-                            Function(0), PrologEnd(0), UnwindOnly(false),
-                            LastFrameInst(-1), ChainedParent(0),
-                            Instructions() {}
+                            Function(0), PrologEnd(0), HandlesUnwind(false),
+                            HandlesExceptions(false), LastFrameInst(-1),
+                            ChainedParent(0), Instructions(), Emitted(false) {}
     MCSymbol *Begin;
     MCSymbol *End;
     const MCSymbol *ExceptionHandler;
     const MCSymbol *Function;
     MCSymbol *PrologEnd;
-    bool UnwindOnly;
+    bool HandlesUnwind;
+    bool HandlesExceptions;
     int LastFrameInst;
     MCWin64EHUnwindInfo *ChainedParent;
     std::vector<MCWin64EHInstruction> Instructions;
+    bool Emitted;
   };
 
   class MCWin64EHUnwindEmitter {
   public:
     //
-    // This emits the unwind info section (.xdata in PE/COFF).
+    // This emits the unwind info sections (.pdata and .xdata in PE/COFF).
     //
     static void Emit(MCStreamer &streamer);
+    static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info);
   };
 } // end namespace llvm
 

Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=131791&r1=131790&r2=131791&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Sat May 21 10:57:49 2011
@@ -362,10 +362,12 @@
   EnsureValidW64UnwindInfo();
   MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
   CurFrame->ExceptionHandler = Sym;
-  if (Unwind)
-    CurFrame->UnwindOnly = true;
-  else if (!Except)
+  if (!Except && !Unwind)
     report_fatal_error("Don't know what kind of handler this is!");
+  if (Unwind)
+    CurFrame->HandlesUnwind = true;
+  if (Except)
+    CurFrame->HandlesExceptions = true;
 }
 
 void MCStreamer::EmitWin64EHHandlerData() {





More information about the llvm-commits mailing list