// CodeGen/RuntimeLibcallSignatures.cpp - R.T. Lib. Call Signatures -*- C++ -*-- // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// This file contains signature information for runtime libcalls. /// /// CodeGen uses external symbols, which it refers to by name. The WebAssembly /// target needs type information for all functions. This file contains a big /// table providing type signatures for all runtime library functions that LLVM /// uses. /// /// This is currently a fairly heavy-handed solution. /// //===----------------------------------------------------------------------===// #include "WebAssemblyRuntimeLibcallSignatures.h" #include "WebAssemblySubtarget.h" #include "WebAssemblyUtilities.h" #include "llvm/CodeGen/RuntimeLibcallUtil.h" usingnamespacellvm; namespace { enum RuntimeLibcallSignature { … }; struct RuntimeLibcallSignatureTable { … }; RuntimeLibcallSignatureTable &getRuntimeLibcallSignatures() { … } // Maps libcall names to their RTLIB::Libcall number. Builds the map in a // constructor for use with a static variable struct StaticLibcallNameMap { … }; } // end anonymous namespace void WebAssembly::getLibcallSignature(const WebAssemblySubtarget &Subtarget, RTLIB::Libcall LC, SmallVectorImpl<wasm::ValType> &Rets, SmallVectorImpl<wasm::ValType> &Params) { … } // TODO: If the RTLIB::Libcall-taking flavor of GetSignature remains unused // other than here, just roll its logic into this version. void WebAssembly::getLibcallSignature(const WebAssemblySubtarget &Subtarget, StringRef Name, SmallVectorImpl<wasm::ValType> &Rets, SmallVectorImpl<wasm::ValType> &Params) { … }