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

Chandler Carruth chandlerc at gmail.com
Mon Jan 23 16:30:17 PST 2012


Author: chandlerc
Date: Mon Jan 23 18:30:17 2012
New Revision: 148759

URL: http://llvm.org/viewvc/llvm-project?rev=148759&view=rev
Log:
Revert r148686 (and r148694, a fix to it) due to a serious layering
violation -- MC cannot depend on CodeGen.

Specifically, the MCTargetDesc component of each target is actually
a subcomponent of the MC library. As such, it cannot depend on the
target-independent code generator, because MC itself cannot depend on
the target-independent code generator. This change moved a flag from the
ARM MCTargetDesc file ARMMCAsmInfo.cpp to the CodeGen layer in
ARMException.cpp, leaving behind an 'extern' to refer back to it. That
layering order isn't viable givin the constraints outlined above.
Commandline flags are designed to be static specifically to avoid these
types of bugs.

Fixing this is likely going to require some non-trivial refactoring.

Modified:
    llvm/trunk/include/llvm/MC/MCAsmInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp
    llvm/trunk/lib/Target/ARM/ARMAsmPrinter.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=148759&r1=148758&r2=148759&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Mon Jan 23 18:30:17 2012
@@ -30,7 +30,6 @@
 
   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=148759&r1=148758&r2=148759&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp Mon Jan 23 18:30:17 2012
@@ -29,7 +29,6 @@
 #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"
@@ -37,18 +36,6 @@
 #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)
@@ -85,15 +72,13 @@
       Asm->OutStreamer.EmitPersonality(PerSym);
     }
 
-    if (EnableARMEHABI == ExceptionHandling::ARMEHABIFull) {
-      // Map all labels and get rid of any dead landing pads.
-      MMI->TidyLandingPads();
+    // 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/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=148759&r1=148758&r2=148759&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Mon Jan 23 18:30:17 2012
@@ -1192,7 +1192,7 @@
   }
 }
 
-extern cl::opt<ExceptionHandling::ARMEHABIMode> EnableARMEHABI;
+extern cl::opt<bool> EnableARMEHABI;
 
 // Simple pseudo-instructions have their lowering (with expansion to real
 // instructions) auto-generated.
@@ -1203,8 +1203,7 @@
     OutStreamer.EmitCodeRegion();
 
   // Emit unwinding stuff for frame-related instructions
-  if (EnableARMEHABI != ExceptionHandling::ARMEHABIDisabled &&
-      MI->getFlag(MachineInstr::FrameSetup))
+  if (EnableARMEHABI && MI->getFlag(MachineInstr::FrameSetup))
     EmitUnwindingInstruction(MI);
 
   // Do any auto-generated pseudo lowerings.

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=148759&r1=148758&r2=148759&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp Mon Jan 23 18:30:17 2012
@@ -16,7 +16,10 @@
 
 using namespace llvm;
 
-extern cl::opt<ExceptionHandling::ARMEHABIMode> EnableARMEHABI;
+cl::opt<bool>
+EnableARMEHABI("arm-enable-ehabi", cl::Hidden,
+  cl::desc("Generate ARM EHABI tables"),
+  cl::init(false));
 
 
 static const char *const arm_asm_table[] = {
@@ -79,6 +82,6 @@
   SupportsDebugInformation = true;
 
   // Exceptions handling
-  if (EnableARMEHABI != ExceptionHandling::ARMEHABIDisabled)
+  if (EnableARMEHABI)
     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=148759&r1=148758&r2=148759&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/ehabi-unwind.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/ehabi-unwind.ll Mon Jan 23 18:30:17 2012
@@ -1,8 +1,7 @@
 ; Test that the EHABI unwind instruction generator does not encounter any
 ; unfamiliar instructions.
-; 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
+; RUN: llc < %s -mtriple=thumbv7 -arm-enable-ehabi -disable-fp-elim
+; RUN: llc < %s -mtriple=thumbv7 -arm-enable-ehabi
 
 define void @_Z1fv() nounwind {
 entry:





More information about the llvm-commits mailing list