diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-04-14 21:41:27 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-06-22 18:20:56 +0000 |
commit | bdd1243df58e60e85101c09001d9812a789b6bc4 (patch) | |
tree | a1ce621c7301dd47ba2ddc3b8eaa63b441389481 /contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp | |
parent | 781624ca2d054430052c828ba8d2c2eaf2d733e7 (diff) | |
parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp b/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp index 96284687971c..7207fbeb305a 100644 --- a/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp @@ -28,10 +28,9 @@ MachineFunctionInfo *WebAssemblyFunctionInfo::clone( BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB) const { - WebAssemblyFunctionInfo *Clone = - DestMF.cloneInfo<WebAssemblyFunctionInfo>(*this); - Clone->MF = &DestMF; - return Clone; + // TODO: Implement cloning for WasmEHFuncInfo. This will have invalid block + // references. + return DestMF.cloneInfo<WebAssemblyFunctionInfo>(*this); } void WebAssemblyFunctionInfo::initWARegs(MachineRegisterInfo &MRI) { @@ -122,11 +121,8 @@ llvm::signatureFromMVTs(const SmallVectorImpl<MVT> &Results, } yaml::WebAssemblyFunctionInfo::WebAssemblyFunctionInfo( - const llvm::WebAssemblyFunctionInfo &MFI) + const llvm::MachineFunction &MF, const llvm::WebAssemblyFunctionInfo &MFI) : CFGStackified(MFI.isCFGStackified()) { - auto *EHInfo = MFI.getWasmEHFuncInfo(); - const llvm::MachineFunction &MF = MFI.getMachineFunction(); - for (auto VT : MFI.getParams()) Params.push_back(EVT(VT).getEVTString()); for (auto VT : MFI.getResults()) @@ -134,7 +130,8 @@ yaml::WebAssemblyFunctionInfo::WebAssemblyFunctionInfo( // MFI.getWasmEHFuncInfo() is non-null only for functions with the // personality function. - if (EHInfo) { + + if (auto *EHInfo = MF.getWasmEHFuncInfo()) { // SrcToUnwindDest can contain stale mappings in case BBs are removed in // optimizations, in case, for example, they are unreachable. We should not // include their info. @@ -155,15 +152,19 @@ void yaml::WebAssemblyFunctionInfo::mappingImpl(yaml::IO &YamlIO) { } void WebAssemblyFunctionInfo::initializeBaseYamlFields( - const yaml::WebAssemblyFunctionInfo &YamlMFI) { + MachineFunction &MF, const yaml::WebAssemblyFunctionInfo &YamlMFI) { CFGStackified = YamlMFI.CFGStackified; for (auto VT : YamlMFI.Params) addParam(WebAssembly::parseMVT(VT.Value)); for (auto VT : YamlMFI.Results) addResult(WebAssembly::parseMVT(VT.Value)); - if (WasmEHInfo) { + + // FIXME: WasmEHInfo is defined in the MachineFunction, but serialized + // here. Either WasmEHInfo should be moved out of MachineFunction, or the + // serialization handling should be moved to MachineFunction. + if (WasmEHFuncInfo *WasmEHInfo = MF.getWasmEHFuncInfo()) { for (auto KV : YamlMFI.SrcToUnwindDest) - WasmEHInfo->setUnwindDest(MF->getBlockNumbered(KV.first), - MF->getBlockNumbered(KV.second)); + WasmEHInfo->setUnwindDest(MF.getBlockNumbered(KV.first), + MF.getBlockNumbered(KV.second)); } } |