aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-08-22 19:00:43 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-11-13 20:39:49 +0000
commitfe6060f10f634930ff71b7c50291ddc610da2475 (patch)
tree1483580c790bd4d27b6500a7542b5ee00534d3cc /contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
parentb61bce17f346d79cecfd8f195a64b10f77be43b1 (diff)
parent344a3780b2e33f6ca763666c380202b18aab72a3 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 32a4f60df097..85c6eca5775e 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -192,10 +192,8 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
MF->getFrameInfo().CreateVariableSizedObject(
Alignment <= StackAlign ? Align(1) : Alignment, AI);
}
- }
-
- // Look for inline asm that clobbers the SP register.
- if (auto *Call = dyn_cast<CallBase>(&I)) {
+ } else if (auto *Call = dyn_cast<CallBase>(&I)) {
+ // Look for inline asm that clobbers the SP register.
if (Call->isInlineAsm()) {
Register SP = TLI->getStackPointerRegisterToSaveRestore();
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
@@ -214,21 +212,20 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
}
}
}
- }
-
- // Look for calls to the @llvm.va_start intrinsic. We can omit some
- // prologue boilerplate for variadic functions that don't examine their
- // arguments.
- if (const auto *II = dyn_cast<IntrinsicInst>(&I)) {
- if (II->getIntrinsicID() == Intrinsic::vastart)
- MF->getFrameInfo().setHasVAStart(true);
- }
+ // Look for calls to the @llvm.va_start intrinsic. We can omit some
+ // prologue boilerplate for variadic functions that don't examine their
+ // arguments.
+ if (const auto *II = dyn_cast<IntrinsicInst>(&I)) {
+ if (II->getIntrinsicID() == Intrinsic::vastart)
+ MF->getFrameInfo().setHasVAStart(true);
+ }
- // If we have a musttail call in a variadic function, we need to ensure we
- // forward implicit register parameters.
- if (const auto *CI = dyn_cast<CallInst>(&I)) {
- if (CI->isMustTailCall() && Fn->isVarArg())
- MF->getFrameInfo().setHasMustTailInVarArgFunc(true);
+ // If we have a musttail call in a variadic function, we need to ensure
+ // we forward implicit register parameters.
+ if (const auto *CI = dyn_cast<CallInst>(&I)) {
+ if (CI->isMustTailCall() && Fn->isVarArg())
+ MF->getFrameInfo().setHasMustTailInVarArgFunc(true);
+ }
}
// Mark values used outside their block as exported, by allocating
@@ -333,14 +330,23 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
else if (Personality == EHPersonality::Wasm_CXX) {
WasmEHFuncInfo &EHInfo = *MF->getWasmEHFuncInfo();
- // Map all BB references in the WinEH data to MBBs.
- DenseMap<BBOrMBB, BBOrMBB> NewMap;
- for (auto &KV : EHInfo.EHPadUnwindMap) {
+ // Map all BB references in the Wasm EH data to MBBs.
+ DenseMap<BBOrMBB, BBOrMBB> SrcToUnwindDest;
+ for (auto &KV : EHInfo.SrcToUnwindDest) {
const auto *Src = KV.first.get<const BasicBlock *>();
- const auto *Dst = KV.second.get<const BasicBlock *>();
- NewMap[MBBMap[Src]] = MBBMap[Dst];
+ const auto *Dest = KV.second.get<const BasicBlock *>();
+ SrcToUnwindDest[MBBMap[Src]] = MBBMap[Dest];
+ }
+ EHInfo.SrcToUnwindDest = std::move(SrcToUnwindDest);
+ DenseMap<BBOrMBB, SmallPtrSet<BBOrMBB, 4>> UnwindDestToSrcs;
+ for (auto &KV : EHInfo.UnwindDestToSrcs) {
+ const auto *Dest = KV.first.get<const BasicBlock *>();
+ UnwindDestToSrcs[MBBMap[Dest]] = SmallPtrSet<BBOrMBB, 4>();
+ for (const auto P : KV.second)
+ UnwindDestToSrcs[MBBMap[Dest]].insert(
+ MBBMap[P.get<const BasicBlock *>()]);
}
- EHInfo.EHPadUnwindMap = std::move(NewMap);
+ EHInfo.UnwindDestToSrcs = std::move(UnwindDestToSrcs);
}
}