summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2018-11-19 17:10:36 +0000
committerWouter van Oortmerssen <aardappel@gmail.com>2018-11-19 17:10:36 +0000
commit49482f824a0d92f8f97121aaa6e82f409ff23d58 (patch)
treeb6619cb3dddaca091bf225cbeadfc1fa224c0904 /llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
parentb25adf5edba0bfb487828600f4294702e695fdba (diff)
downloadbcm5719-llvm-49482f824a0d92f8f97121aaa6e82f409ff23d58.tar.gz
bcm5719-llvm-49482f824a0d92f8f97121aaa6e82f409ff23d58.zip
[WebAssembly] replaced .param/.result by .functype
Summary: This makes it easier/cleaner to generate a single signature from this directive. Also: - Adds the symbol name, such that we don't depend on the location of this directive anymore. - Actually constructs the signature in the assembler, and make the assembler own it. - Refactor the use of MVT vs ValType in the streamer and assembler to require less conversions overall. - Changed 700 or so tests to use it. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, eraman, aheejin, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D54652 llvm-svn: 347228
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
index 073706e567e..0157af0f851 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
@@ -64,13 +64,17 @@ void llvm::ComputeSignatureVTs(const FunctionType *Ty, const Function &F,
Params.push_back(PtrVT);
}
+void llvm::ValTypesFromMVTs(const ArrayRef<MVT> &In,
+ SmallVectorImpl<wasm::ValType> &Out) {
+ for (MVT Ty : In)
+ Out.push_back(WebAssembly::toValType(Ty));
+}
+
std::unique_ptr<wasm::WasmSignature>
llvm::SignatureFromMVTs(const SmallVectorImpl<MVT> &Results,
const SmallVectorImpl<MVT> &Params) {
auto Sig = make_unique<wasm::WasmSignature>();
- for (MVT Ty : Results)
- Sig->Returns.push_back(WebAssembly::toValType(Ty));
- for (MVT Ty : Params)
- Sig->Params.push_back(WebAssembly::toValType(Ty));
+ ValTypesFromMVTs(Results, Sig->Returns);
+ ValTypesFromMVTs(Params, Sig->Params);
return Sig;
}
OpenPOWER on IntegriCloud