diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
commit | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (patch) | |
tree | 599ab169a01f1c86eda9adc774edaedde2f2db5b /lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp | |
parent | 1a56a5ead7a2e84bee8240f5f6b033b5f1707154 (diff) |
Notes
Diffstat (limited to 'lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp')
-rw-r--r-- | lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp b/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp index 0157af0f8510..d31c1226bfdb 100644 --- a/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp +++ b/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp @@ -1,9 +1,8 @@ //=- WebAssemblyMachineFunctionInfo.cpp - WebAssembly Machine Function Info -=// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// /// @@ -19,7 +18,7 @@ #include "llvm/CodeGen/Analysis.h" using namespace llvm; -WebAssemblyFunctionInfo::~WebAssemblyFunctionInfo() {} +WebAssemblyFunctionInfo::~WebAssemblyFunctionInfo() = default; // anchor. void WebAssemblyFunctionInfo::initWARegs() { assert(WARegs.empty()); @@ -27,7 +26,7 @@ void WebAssemblyFunctionInfo::initWARegs() { WARegs.resize(MF.getRegInfo().getNumVirtRegs(), Reg); } -void llvm::ComputeLegalValueVTs(const Function &F, const TargetMachine &TM, +void llvm::computeLegalValueVTs(const Function &F, const TargetMachine &TM, Type *Ty, SmallVectorImpl<MVT> &ValueVTs) { const DataLayout &DL(F.getParent()->getDataLayout()); const WebAssemblyTargetLowering &TLI = @@ -38,16 +37,16 @@ void llvm::ComputeLegalValueVTs(const Function &F, const TargetMachine &TM, for (EVT VT : VTs) { unsigned NumRegs = TLI.getNumRegisters(F.getContext(), VT); MVT RegisterVT = TLI.getRegisterType(F.getContext(), VT); - for (unsigned i = 0; i != NumRegs; ++i) + for (unsigned I = 0; I != NumRegs; ++I) ValueVTs.push_back(RegisterVT); } } -void llvm::ComputeSignatureVTs(const FunctionType *Ty, const Function &F, +void llvm::computeSignatureVTs(const FunctionType *Ty, const Function &F, const TargetMachine &TM, SmallVectorImpl<MVT> &Params, SmallVectorImpl<MVT> &Results) { - ComputeLegalValueVTs(F, TM, Ty->getReturnType(), Results); + computeLegalValueVTs(F, TM, Ty->getReturnType(), Results); MVT PtrVT = MVT::getIntegerVT(TM.createDataLayout().getPointerSizeInBits()); if (Results.size() > 1) { @@ -59,22 +58,35 @@ void llvm::ComputeSignatureVTs(const FunctionType *Ty, const Function &F, } for (auto *Param : Ty->params()) - ComputeLegalValueVTs(F, TM, Param, Params); + computeLegalValueVTs(F, TM, Param, Params); if (Ty->isVarArg()) Params.push_back(PtrVT); } -void llvm::ValTypesFromMVTs(const ArrayRef<MVT> &In, +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, +llvm::signatureFromMVTs(const SmallVectorImpl<MVT> &Results, const SmallVectorImpl<MVT> &Params) { auto Sig = make_unique<wasm::WasmSignature>(); - ValTypesFromMVTs(Results, Sig->Returns); - ValTypesFromMVTs(Params, Sig->Params); + valTypesFromMVTs(Results, Sig->Returns); + valTypesFromMVTs(Params, Sig->Params); return Sig; } + +yaml::WebAssemblyFunctionInfo::WebAssemblyFunctionInfo( + const llvm::WebAssemblyFunctionInfo &MFI) + : CFGStackified(MFI.isCFGStackified()) {} + +void yaml::WebAssemblyFunctionInfo::mappingImpl(yaml::IO &YamlIO) { + MappingTraits<WebAssemblyFunctionInfo>::mapping(YamlIO, *this); +} + +void WebAssemblyFunctionInfo::initializeBaseYamlFields( + const yaml::WebAssemblyFunctionInfo &YamlMFI) { + CFGStackified = YamlMFI.CFGStackified; +} |