[llvm-commits] [llvm] r148686 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h lib/CodeGen/AsmPrinter/ARMException.cpp lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp test/CodeGen/ARM/ehabi-unwind.ll

Evgeniy Stepanov eugeni.stepanov at gmail.com
Sun Jan 22 23:57:40 PST 2012


Author: eugenis
Date: Mon Jan 23 01:57:39 2012
New Revision: 148686

URL: http://llvm.org/viewvc/llvm-project?rev=148686&view=rev
Log:
An option to selectively enable parts of ARM EHABI support.

This change adds an new value to the --arm-enable-ehabi option that
disables emitting unwinding descriptors. This mode gives a working
backtrace() without the (currently broken) exception support.

Modified:
    llvm/trunk/include/llvm/MC/MCAsmInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
    llvm/trunk/test/CodeGen/ARM/ehabi-unwind.ll

Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=148686&r1=148685&r2=148686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Mon Jan 23 01:57:39 2012
@@ -30,6 +30,7 @@
 
   namespace ExceptionHandling {
     enum ExceptionsType { None, DwarfCFI, SjLj, ARM, Win64 };
+    enum ARMEHABIMode { ARMEHABIDisabled, ARMEHABIUnwind, ARMEHABIFull };
   }
 
   namespace LCOMM {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp?rev=148686&r1=148685&r2=148686&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp Mon Jan 23 01:57:39 2012
@@ -29,6 +29,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Dwarf.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/ADT/SmallString.h"
@@ -36,6 +37,18 @@
 #include "llvm/ADT/Twine.h"
 using namespace llvm;
 
+cl::opt<ExceptionHandling::ARMEHABIMode>
+EnableARMEHABI("arm-enable-ehabi", cl::Hidden,
+    cl::desc("Generate ARM EHABI tables:"),
+    cl::values(clEnumValN(ExceptionHandling::ARMEHABIDisabled, "no",
+            "Do not generate ARM EHABI tables"),
+        clEnumValN(ExceptionHandling::ARMEHABIUnwind, "unwind",
+            "Emit unwinding instructions, but not descriptors"),
+        clEnumValN(ExceptionHandling::ARMEHABIFull, "full",
+            "Generate full ARM EHABI tables"),
+        clEnumValEnd));
+
+
 ARMException::ARMException(AsmPrinter *A)
   : DwarfException(A),
     shouldEmitTable(false), shouldEmitMoves(false), shouldEmitTableModule(false)
@@ -72,13 +85,15 @@
       Asm->OutStreamer.EmitPersonality(PerSym);
     }
 
-    // Map all labels and get rid of any dead landing pads.
-    MMI->TidyLandingPads();
+    if (EnableARMEHABI == ExceptionHandling::ARMEHABIFull) {
+      // Map all labels and get rid of any dead landing pads.
+      MMI->TidyLandingPads();
 
-    Asm->OutStreamer.EmitHandlerData();
+      Asm->OutStreamer.EmitHandlerData();
 
-    // Emit actual exception table
-    EmitExceptionTable();
+      // Emit actual exception table
+      EmitExceptionTable();
+    }
   }
 
   Asm->OutStreamer.EmitFnEnd();

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp?rev=148686&r1=148685&r2=148686&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp Mon Jan 23 01:57:39 2012
@@ -16,10 +16,7 @@
 
 using namespace llvm;
 
-cl::opt<bool>
-EnableARMEHABI("arm-enable-ehabi", cl::Hidden,
-  cl::desc("Generate ARM EHABI tables"),
-  cl::init(false));
+extern cl::opt<ExceptionHandling::ARMEHABIMode> EnableARMEHABI;
 
 
 static const char *const arm_asm_table[] = {
@@ -82,6 +79,6 @@
   SupportsDebugInformation = true;
 
   // Exceptions handling
-  if (EnableARMEHABI)
+  if (EnableARMEHABI != ExceptionHandling::ARMEHABIDisabled)
     ExceptionsType = ExceptionHandling::ARM;
 }

Modified: llvm/trunk/test/CodeGen/ARM/ehabi-unwind.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ehabi-unwind.ll?rev=148686&r1=148685&r2=148686&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ehabi-unwind.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ehabi-unwind.ll Mon Jan 23 01:57:39 2012
@@ -1,7 +1,8 @@
 ; Test that the EHABI unwind instruction generator does not encounter any
 ; unfamiliar instructions.
-; RUN: llc < %s -mtriple=thumbv7 -arm-enable-ehabi -disable-fp-elim
-; RUN: llc < %s -mtriple=thumbv7 -arm-enable-ehabi
+; RUN: llc < %s -mtriple=thumbv7 -arm-enable-ehabi=full -disable-fp-elim
+; RUN: llc < %s -mtriple=thumbv7 -arm-enable-ehabi=full
+; RUN: llc < %s -mtriple=thumbv7 -arm-enable-ehabi=unwind
 
 define void @_Z1fv() nounwind {
 entry:





More information about the llvm-commits mailing list