<div dir="ltr">On Fri, May 20, 2016 at 10:22 PM, 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"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, May 20, 2016 at 8:07 PM, Saleem Abdulrasool <span dir="ltr"><<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span>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></span><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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></span><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.</div></div></div></div></blockquote><div><br></div></span><div>My concern is that you won't be able to support modules with both SjLj and zero-cost exceptions.</div></div></div></div></blockquote><div><br></div><div>Oh, but thats exactly the reason for this change. The frontend can now pass along whether SjLj exceptions are desired (via -fsjlj-exceptions). This will then be passed to the backend explicitly. Currently, we assume that only a single exception model exists on a target, and this generalizes it to permit different ones on a per-target basis.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> 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></div></blockquote><div><br></div></span><div>Why? Can't TLI just do: DAG.getMachineFunction().getFunction()->getPersonalityFn() ?</div></div></div></div></blockquote><div><br></div><div>Sorry, I meant target lowering, not TLI. The DAG is not provided to the constructor. Furthermore, it seems that there is a means to do something explicitly rather than trying to infer it from patterns. Why the preference for the patterns then?</div><div><br></div><div>Im afraid that Im still not seeing your concern. Could you please be a bit more explicit about it? Whats the situation that you envision where this breaks down?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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></div></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>
</font></span></div></div>
</blockquote></div></div></div><br></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>