<div dir="ltr">On Fri, May 20, 2016 at 12:02 AM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Why do we even need ExceptionHandling? Can't this be inferred from the personality routine (+ maybe the triple)?</blockquote><div><br></div><div>Well, I just need to know if SjLj is in use.  If your argument is on the extra bits, I can shrink it to 1 bit.  The triple won't tell us the exception model when zero cost is available and preferable.  Pulling it from the personality feels less than ideal, and not always possible (like in TLI which cares since the Unwind interfaces are different).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>On Thursday, May 19, 2016, Saleem Abdulrasool via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: compnerd<br>
Date: Thu May 19 22:39:28 2016<br>
New Revision: 270178<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=270178&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=270178&view=rev</a><br>
Log:<br>
Target: move the EH enumeration and add option<br>
<br>
Move the ExceptionHandling enumeration into TargetOptions and introduce a field<br>
to track the desired exception model.  This will allow us to set the exception<br>
model from the frontend (needed to optionally use SjLj EH on other targets where<br>
zero-cost is available and preferred).<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/MC/MCAsmInfo.h<br>
    llvm/trunk/include/llvm/Target/TargetOptions.h<br>
<br>
Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=270178&r1=270177&r2=270178&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=270178&r1=270177&r2=270178&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)<br>
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Thu May 19 22:39:28 2016<br>
@@ -16,6 +16,7 @@<br>
 #ifndef LLVM_MC_MCASMINFO_H<br>
 #define LLVM_MC_MCASMINFO_H<br>
<br>
+#include "llvm/Target/TargetOptions.h"<br>
 #include "llvm/MC/MCDirectives.h"<br>
 #include "llvm/MC/MCDwarf.h"<br>
 #include <cassert><br>
@@ -41,14 +42,6 @@ enum class EncodingType {<br>
 };<br>
 }<br>
<br>
-enum class ExceptionHandling {<br>
-  None,     /// No exception support<br>
-  DwarfCFI, /// DWARF-like instruction based exceptions<br>
-  SjLj,     /// setjmp/longjmp based exceptions<br>
-  ARM,      /// ARM EHABI<br>
-  WinEH,    /// Windows Exception Handling<br>
-};<br>
-<br>
 namespace LCOMM {<br>
 enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };<br>
 }<br>
<br>
Modified: llvm/trunk/include/llvm/Target/TargetOptions.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=270178&r1=270177&r2=270178&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=270178&r1=270177&r2=270178&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Target/TargetOptions.h (original)<br>
+++ llvm/trunk/include/llvm/Target/TargetOptions.h Thu May 19 22:39:28 2016<br>
@@ -88,6 +88,14 @@ namespace llvm {<br>
     SCE       // Tune debug info for SCE targets (e.g. PS4).<br>
   };<br>
<br>
+  enum class ExceptionHandling {<br>
+    None,     /// No exception support<br>
+    DwarfCFI, /// DWARF-like instruction based exceptions<br>
+    SjLj,     /// setjmp/longjmp based exceptions<br>
+    ARM,      /// ARM EHABI<br>
+    WinEH,    /// Windows Exception Handling<br>
+  };<br>
+<br>
   class TargetOptions {<br>
   public:<br>
     TargetOptions()<br>
@@ -95,14 +103,15 @@ namespace llvm {<br>
           UnsafeFPMath(false), NoInfsFPMath(false), NoNaNsFPMath(false),<br>
           HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),<br>
           GuaranteedTailCallOpt(false), StackAlignmentOverride(0),<br>
-          StackSymbolOrdering(true), EnableFastISel(false),<br>
-          UseInitArray(false), DisableIntegratedAS(false),<br>
-          CompressDebugSections(false), FunctionSections(false),<br>
-          DataSections(false), UniqueSectionNames(true), TrapUnreachable(false),<br>
-          EmulatedTLS(false), FloatABIType(FloatABI::Default),<br>
+          StackSymbolOrdering(true), EnableFastISel(false), UseInitArray(false),<br>
+          DisableIntegratedAS(false), CompressDebugSections(false),<br>
+          FunctionSections(false), DataSections(false),<br>
+          UniqueSectionNames(true), TrapUnreachable(false), EmulatedTLS(false),<br>
+          FloatABIType(FloatABI::Default),<br>
           AllowFPOpFusion(FPOpFusion::Standard), Reciprocals(TargetRecip()),<br>
           JTType(JumpTable::Single), ThreadModel(ThreadModel::POSIX),<br>
-          EABIVersion(EABI::Default), DebuggerTuning(DebuggerKind::Default) {}<br>
+          EABIVersion(EABI::Default), DebuggerTuning(DebuggerKind::Default),<br>
+          ExceptionModel(ExceptionHandling::None) {}<br>
<br>
     /// PrintMachineCode - This flag is enabled when the -print-machineinstrs<br>
     /// option is specified on the command line, and should enable debugging<br>
@@ -246,6 +255,9 @@ namespace llvm {<br>
     /// Which debugger to tune for.<br>
     DebuggerKind DebuggerTuning;<br>
<br>
+    /// What exception model to use<br>
+    ExceptionHandling ExceptionModel;<br>
+<br>
     /// Machine level options.<br>
     MCTargetOptions MCOptions;<br>
   };<br>
@@ -275,6 +287,7 @@ inline bool operator==(const TargetOptio<br>
     ARE_EQUAL(ThreadModel) &&<br>
     ARE_EQUAL(EABIVersion) &&<br>
     ARE_EQUAL(DebuggerTuning) &&<br>
+    ARE_EQUAL(ExceptionModel) &&<br>
     ARE_EQUAL(MCOptions);<br>
 #undef ARE_EQUAL<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a>llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>
</div></div>