]> granicus.if.org Git - clang/commitdiff
[WebAssembly] Add exception handling option
authorHeejin Ahn <aheejin@gmail.com>
Fri, 2 Mar 2018 00:39:16 +0000 (00:39 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Fri, 2 Mar 2018 00:39:16 +0000 (00:39 +0000)
Summary: Add exception handling option to clang.

Reviewers: dschuff

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326517 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 595909eef077d977223dbc89183c699b152167be..0026f1fbd0b66b1c02b52c3bf8757dad4517d14a 100644 (file)
@@ -2352,6 +2352,8 @@ WebAssembly
 
 .. option:: -msimd128, -mno-simd128
 
+.. option:: -mexception-handling, -mno-exception-handling
+
 X86
 ---
 .. option:: -m3dnow, -mno-3dnow
index af69c018fb510430366ae2fa36c9d23ccdea027a..6824858b992ff70496a5252f177d36dfef1dd074 100644 (file)
@@ -1917,6 +1917,8 @@ def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group<m_wasm_Fea
 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]>,
index 4338d03ade05f82eeb1a4c4a3dcec35827d95333..b8a2a092aff4ad8a4869de0871ef35f64adc395f 100644 (file)
@@ -37,6 +37,7 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
       .Case("simd128", SIMDLevel >= SIMD128)
       .Case("nontrapping-fptoint", HasNontrappingFPToInt)
       .Case("sign-ext", HasSignExt)
+      .Case("exception-handling", HasExceptionHandling)
       .Default(false);
 }
 
@@ -83,6 +84,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
       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 305463cd3c75faacb43071bc6dced07c2277d0cb..b0e466b8d8c24283643a5a06575975d3c4d37865 100644 (file)
@@ -32,11 +32,12 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
 
   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;