[WebAssembly] Add multivalue and tail-call target features

Summary:
These features will both be implemented soon, so I thought I would
save time by adding the boilerplate for both of them at the same time.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 361516
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp
index 2fceed2..b16442b 100644
--- a/clang/lib/Basic/Targets/WebAssembly.cpp
+++ b/clang/lib/Basic/Targets/WebAssembly.cpp
@@ -43,6 +43,8 @@
       .Case("bulk-memory", HasBulkMemory)
       .Case("atomics", HasAtomics)
       .Case("mutable-globals", HasMutableGlobals)
+      .Case("multivalue", HasMultivalue)
+      .Case("tail-call", HasTailCall)
       .Default(false);
 }
 
@@ -74,6 +76,10 @@
     Builder.defineMacro("__wasm_atomics__");
   if (HasMutableGlobals)
     Builder.defineMacro("__wasm_mutable_globals__");
+  if (HasMultivalue)
+    Builder.defineMacro("__wasm_multivalue__");
+  if (HasTailCall)
+    Builder.defineMacro("__wasm_tail_call__");
 }
 
 void WebAssemblyTargetInfo::setSIMDLevel(llvm::StringMap<bool> &Features,
@@ -116,6 +122,10 @@
     Features["atomics"] = true;
   if (HasMutableGlobals)
     Features["mutable-globals"] = true;
+  if (HasMultivalue)
+    Features["multivalue"] = true;
+  if (HasTailCall)
+    Features["tail-call"] = true;
 
   return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
 }
@@ -187,6 +197,22 @@
       HasMutableGlobals = false;
       continue;
     }
+    if (Feature == "+multivalue") {
+      HasMultivalue = true;
+      continue;
+    }
+    if (Feature == "-multivalue") {
+      HasMultivalue = false;
+      continue;
+    }
+    if (Feature == "+tail-call") {
+      HasTailCall = true;
+      continue;
+    }
+    if (Feature == "-tail-call") {
+      HasTailCall = false;
+      continue;
+    }
 
     Diags.Report(diag::err_opt_not_valid_with_opt)
         << Feature << "-target-feature";