[PATCH] D43681: [WebAssembly] Add exception handling option

2018-03-01 Thread Heejin Ahn via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL326517: [WebAssembly] Add exception handling option 
(authored by aheejin, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D43681

Files:
  cfe/trunk/docs/ClangCommandLineReference.rst
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
  cfe/trunk/lib/Basic/Targets/WebAssembly.h


Index: cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
===
--- cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
@@ -37,6 +37,7 @@
   .Case("simd128", SIMDLevel >= SIMD128)
   .Case("nontrapping-fptoint", HasNontrappingFPToInt)
   .Case("sign-ext", HasSignExt)
+  .Case("exception-handling", HasExceptionHandling)
   .Default(false);
 }
 
@@ -83,6 +84,14 @@
   HasSignExt = false;
   continue;
 }
+if (Feature == "+exception-handling") {
+  HasExceptionHandling = true;
+  continue;
+}
+if (Feature == "-exception-handling") {
+  HasExceptionHandling = false;
+  continue;
+}
 
 Diags.Report(diag::err_opt_not_valid_with_opt)
 << Feature << "-target-feature";
Index: cfe/trunk/lib/Basic/Targets/WebAssembly.h
===
--- cfe/trunk/lib/Basic/Targets/WebAssembly.h
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.h
@@ -32,11 +32,12 @@
 
   bool HasNontrappingFPToInt;
   bool HasSignExt;
+  bool HasExceptionHandling;
 
 public:
   explicit WebAssemblyTargetInfo(const llvm::Triple , const TargetOptions &)
   : TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false),
-HasSignExt(false) {
+HasSignExt(false), HasExceptionHandling(false) {
 NoAsmVariants = true;
 SuitableAlign = 128;
 LargeArrayMinWidth = 128;
Index: cfe/trunk/docs/ClangCommandLineReference.rst
===
--- cfe/trunk/docs/ClangCommandLineReference.rst
+++ cfe/trunk/docs/ClangCommandLineReference.rst
@@ -2352,6 +2352,8 @@
 
 .. option:: -msimd128, -mno-simd128
 
+.. option:: -mexception-handling, -mno-exception-handling
+
 X86
 ---
 .. option:: -m3dnow, -mno-3dnow
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1917,6 +1917,8 @@
 def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, 
Group;
 def msign_ext : Flag<["-"], "msign-ext">, Group;
 def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group;
+def mexception_handing : Flag<["-"], "mexception-handling">, 
Group;
+def mno_exception_handing : Flag<["-"], "mno-exception-handling">, 
Group;
 
 def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">,
   Flags<[HelpHidden]>,


Index: cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
===
--- cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
@@ -37,6 +37,7 @@
   .Case("simd128", SIMDLevel >= SIMD128)
   .Case("nontrapping-fptoint", HasNontrappingFPToInt)
   .Case("sign-ext", HasSignExt)
+  .Case("exception-handling", HasExceptionHandling)
   .Default(false);
 }
 
@@ -83,6 +84,14 @@
   HasSignExt = false;
   continue;
 }
+if (Feature == "+exception-handling") {
+  HasExceptionHandling = true;
+  continue;
+}
+if (Feature == "-exception-handling") {
+  HasExceptionHandling = false;
+  continue;
+}
 
 Diags.Report(diag::err_opt_not_valid_with_opt)
 << Feature << "-target-feature";
Index: cfe/trunk/lib/Basic/Targets/WebAssembly.h
===
--- cfe/trunk/lib/Basic/Targets/WebAssembly.h
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.h
@@ -32,11 +32,12 @@
 
   bool HasNontrappingFPToInt;
   bool HasSignExt;
+  bool HasExceptionHandling;
 
 public:
   explicit WebAssemblyTargetInfo(const llvm::Triple , const TargetOptions &)
   : TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false),
-HasSignExt(false) {
+HasSignExt(false), HasExceptionHandling(false) {
 NoAsmVariants = true;
 SuitableAlign = 128;
 LargeArrayMinWidth = 128;
Index: cfe/trunk/docs/ClangCommandLineReference.rst
===
--- cfe/trunk/docs/ClangCommandLineReference.rst
+++ cfe/trunk/docs/ClangCommandLineReference.rst
@@ -2352,6 +2352,8 @@
 
 .. option:: -msimd128, -mno-simd128
 
+.. option:: -mexception-handling, -mno-exception-handling
+
 X86
 ---
 .. option:: -m3dnow, -mno-3dnow
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- 

[PATCH] D43681: [WebAssembly] Add exception handling option

2018-03-01 Thread Derek Schuff via Phabricator via cfe-commits
dschuff accepted this revision.
dschuff added a comment.
This revision is now accepted and ready to land.

This flag turns on CPU features (i.e. there's one for each new wasm feature 
proposal that has to be feature-detected), so I think this makes sense to be 
consistent with all the others. I could imagine enabling exceptions in the 
frontend but having some kind of emulation in the backend (like we do today for 
emscripten). More generally the semantics `-fno-exceptions` unfortunately 
doesn't exactly match the kind of behavior people typically want because it 
doesn't allow you to compile code that has try/catch/throw at all. In PNaCl and 
emscripten the default behavior is instead to compile that code but to lower it 
away and turn throw into abort. Also IIRC even with `-fno-exceptions` the code 
still has to allow exceptions to propagate which means you end up with invokes 
everywhere instead of calls, so you are still paying most of the costs of 
enabling EH. So that bit is a little bit complex and we'll probably want to 
think a bit more carefully about what options we want to have. But a machine 
flag for enabling the CPU feature makes sense to start.


Repository:
  rC Clang

https://reviews.llvm.org/D43681



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43681: [WebAssembly] Add exception handling option

2018-02-27 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added a comment.

Don't we already have `-fexceptions` and `-fno-exceptions` for this?


Repository:
  rC Clang

https://reviews.llvm.org/D43681



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43681: [WebAssembly] Add exception handling option

2018-02-23 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin created this revision.
aheejin added a reviewer: dschuff.
Herald added subscribers: cfe-commits, sunfish, jgravelle-google, sbc100, jfb.

Add exception handling option to clang.


Repository:
  rC Clang

https://reviews.llvm.org/D43681

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  lib/Basic/Targets/WebAssembly.cpp
  lib/Basic/Targets/WebAssembly.h


Index: lib/Basic/Targets/WebAssembly.h
===
--- lib/Basic/Targets/WebAssembly.h
+++ lib/Basic/Targets/WebAssembly.h
@@ -32,11 +32,12 @@
 
   bool HasNontrappingFPToInt;
   bool HasSignExt;
+  bool HasExceptionHandling;
 
 public:
   explicit WebAssemblyTargetInfo(const llvm::Triple , const TargetOptions &)
   : TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false),
-HasSignExt(false) {
+HasSignExt(false), HasExceptionHandling(false) {
 NoAsmVariants = true;
 SuitableAlign = 128;
 LargeArrayMinWidth = 128;
Index: lib/Basic/Targets/WebAssembly.cpp
===
--- lib/Basic/Targets/WebAssembly.cpp
+++ lib/Basic/Targets/WebAssembly.cpp
@@ -37,6 +37,7 @@
   .Case("simd128", SIMDLevel >= SIMD128)
   .Case("nontrapping-fptoint", HasNontrappingFPToInt)
   .Case("sign-ext", HasSignExt)
+  .Case("exception-handling", HasExceptionHandling)
   .Default(false);
 }
 
@@ -83,6 +84,14 @@
   HasSignExt = false;
   continue;
 }
+if (Feature == "+exception-handling") {
+  HasExceptionHandling = true;
+  continue;
+}
+if (Feature == "-exception-handling") {
+  HasExceptionHandling = false;
+  continue;
+}
 
 Diags.Report(diag::err_opt_not_valid_with_opt)
 << Feature << "-target-feature";
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1902,6 +1902,8 @@
 def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, 
Group;
 def msign_ext : Flag<["-"], "msign-ext">, Group;
 def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group;
+def mexception_handing : Flag<["-"], "mexception-handling">, 
Group;
+def mno_exception_handing : Flag<["-"], "mno-exception-handling">, 
Group;
 
 def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">,
   Flags<[HelpHidden]>,
Index: docs/ClangCommandLineReference.rst
===
--- docs/ClangCommandLineReference.rst
+++ docs/ClangCommandLineReference.rst
@@ -2352,6 +2352,8 @@
 
 .. option:: -msimd128, -mno-simd128
 
+.. option:: -mexception-handling, -mno-exception-handling
+
 X86
 ---
 .. option:: -m3dnow, -mno-3dnow


Index: lib/Basic/Targets/WebAssembly.h
===
--- lib/Basic/Targets/WebAssembly.h
+++ lib/Basic/Targets/WebAssembly.h
@@ -32,11 +32,12 @@
 
   bool HasNontrappingFPToInt;
   bool HasSignExt;
+  bool HasExceptionHandling;
 
 public:
   explicit WebAssemblyTargetInfo(const llvm::Triple , const TargetOptions &)
   : TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false),
-HasSignExt(false) {
+HasSignExt(false), HasExceptionHandling(false) {
 NoAsmVariants = true;
 SuitableAlign = 128;
 LargeArrayMinWidth = 128;
Index: lib/Basic/Targets/WebAssembly.cpp
===
--- lib/Basic/Targets/WebAssembly.cpp
+++ lib/Basic/Targets/WebAssembly.cpp
@@ -37,6 +37,7 @@
   .Case("simd128", SIMDLevel >= SIMD128)
   .Case("nontrapping-fptoint", HasNontrappingFPToInt)
   .Case("sign-ext", HasSignExt)
+  .Case("exception-handling", HasExceptionHandling)
   .Default(false);
 }
 
@@ -83,6 +84,14 @@
   HasSignExt = false;
   continue;
 }
+if (Feature == "+exception-handling") {
+  HasExceptionHandling = true;
+  continue;
+}
+if (Feature == "-exception-handling") {
+  HasExceptionHandling = false;
+  continue;
+}
 
 Diags.Report(diag::err_opt_not_valid_with_opt)
 << Feature << "-target-feature";
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1902,6 +1902,8 @@
 def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group;
 def msign_ext : Flag<["-"], "msign-ext">, Group;
 def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group;
+def mexception_handing : Flag<["-"], "mexception-handling">, Group;
+def mno_exception_handing : Flag<["-"], "mno-exception-handling">, Group;
 
 def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">,
   Flags<[HelpHidden]>,
Index: docs/ClangCommandLineReference.rst
===
--- docs/ClangCommandLineReference.rst