r326517 - [WebAssembly] Add exception handling option

Heejin Ahn via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 1 16:39:17 PST 2018


Author: aheejin
Date: Thu Mar  1 16:39:16 2018
New Revision: 326517

URL: http://llvm.org/viewvc/llvm-project?rev=326517&view=rev
Log:
[WebAssembly] Add exception handling option

Summary: Add exception handling option to clang.

Reviewers: dschuff

Subscribers: jfb, sbc100, jgravelle-google, sunfish, cfe-commits

Differential Revision: https://reviews.llvm.org/D43681

Modified:
    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

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=326517&r1=326516&r2=326517&view=diff
==============================================================================
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Thu Mar  1 16:39:16 2018
@@ -2352,6 +2352,8 @@ WebAssembly
 
 .. option:: -msimd128, -mno-simd128
 
+.. option:: -mexception-handling, -mno-exception-handling
+
 X86
 ---
 .. option:: -m3dnow, -mno-3dnow

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=326517&r1=326516&r2=326517&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Mar  1 16:39:16 2018
@@ -1917,6 +1917,8 @@ def mnontrapping_fptoint : Flag<["-"], "
 def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group<m_wasm_Features_Group>;
 def msign_ext : Flag<["-"], "msign-ext">, Group<m_wasm_Features_Group>;
 def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group<m_wasm_Features_Group>;
+def mexception_handing : Flag<["-"], "mexception-handling">, Group<m_wasm_Features_Group>;
+def mno_exception_handing : Flag<["-"], "mno-exception-handling">, Group<m_wasm_Features_Group>;
 
 def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">,
   Flags<[HelpHidden]>,

Modified: cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/WebAssembly.cpp?rev=326517&r1=326516&r2=326517&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/WebAssembly.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.cpp Thu Mar  1 16:39:16 2018
@@ -37,6 +37,7 @@ bool WebAssemblyTargetInfo::hasFeature(S
       .Case("simd128", SIMDLevel >= SIMD128)
       .Case("nontrapping-fptoint", HasNontrappingFPToInt)
       .Case("sign-ext", HasSignExt)
+      .Case("exception-handling", HasExceptionHandling)
       .Default(false);
 }
 
@@ -83,6 +84,14 @@ bool WebAssemblyTargetInfo::handleTarget
       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";

Modified: cfe/trunk/lib/Basic/Targets/WebAssembly.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/WebAssembly.h?rev=326517&r1=326516&r2=326517&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/WebAssembly.h (original)
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.h Thu Mar  1 16:39:16 2018
@@ -32,11 +32,12 @@ class LLVM_LIBRARY_VISIBILITY WebAssembl
 
   bool HasNontrappingFPToInt;
   bool HasSignExt;
+  bool HasExceptionHandling;
 
 public:
   explicit WebAssemblyTargetInfo(const llvm::Triple &T, const TargetOptions &)
       : TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false),
-        HasSignExt(false) {
+        HasSignExt(false), HasExceptionHandling(false) {
     NoAsmVariants = true;
     SuitableAlign = 128;
     LargeArrayMinWidth = 128;




More information about the cfe-commits mailing list