summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2018-03-02 00:39:16 +0000
committerHeejin Ahn <aheejin@gmail.com>2018-03-02 00:39:16 +0000
commit8b6af22e6034b68cf737005de46fbee6ab287ca2 (patch)
treebd076f2519b2052654859ec115015bc8096c3c22
parent3f547fe8571c2bb6b3fd10bef6af08da1436bd85 (diff)
downloadbcm5719-llvm-8b6af22e6034b68cf737005de46fbee6ab287ca2.tar.gz
bcm5719-llvm-8b6af22e6034b68cf737005de46fbee6ab287ca2.zip
[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 llvm-svn: 326517
-rw-r--r--clang/docs/ClangCommandLineReference.rst2
-rw-r--r--clang/include/clang/Driver/Options.td2
-rw-r--r--clang/lib/Basic/Targets/WebAssembly.cpp9
-rw-r--r--clang/lib/Basic/Targets/WebAssembly.h3
4 files changed, 15 insertions, 1 deletions
diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst
index 595909eef07..0026f1fbd0b 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -2352,6 +2352,8 @@ WebAssembly
.. option:: -msimd128, -mno-simd128
+.. option:: -mexception-handling, -mno-exception-handling
+
X86
---
.. option:: -m3dnow, -mno-3dnow
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index af69c018fb5..6824858b992 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -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]>,
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp
index 4338d03ade0..b8a2a092aff 100644
--- a/clang/lib/Basic/Targets/WebAssembly.cpp
+++ b/clang/lib/Basic/Targets/WebAssembly.cpp
@@ -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";
diff --git a/clang/lib/Basic/Targets/WebAssembly.h b/clang/lib/Basic/Targets/WebAssembly.h
index 305463cd3c7..b0e466b8d8c 100644
--- a/clang/lib/Basic/Targets/WebAssembly.h
+++ b/clang/lib/Basic/Targets/WebAssembly.h
@@ -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;
OpenPOWER on IntegriCloud