From 482cdc4ebd0e3a8c87bb555e155f5c7b574b5a88 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Mon, 23 Jan 2012 07:57:39 +0000 Subject: 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. llvm-svn: 148686 --- llvm/lib/CodeGen/AsmPrinter/ARMException.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/ARMException.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp index 3f238732536..e5a7d05f4c5 100644 --- a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp @@ -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 +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 @@ void ARMException::EndFunction() { 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(); -- cgit v1.2.3