File indexing completed on 2026-05-10 08:44:38
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "llvm/IR/Dominators.h"
0010 #include "llvm/Transforms/Coroutines/CoroShape.h"
0011 #include "llvm/Transforms/Coroutines/SuspendCrossingInfo.h"
0012
0013 #ifndef LLVM_TRANSFORMS_COROUTINES_SPILLINGINFO_H
0014 #define LLVM_TRANSFORMS_COROUTINES_SPILLINGINFO_H
0015
0016 namespace llvm {
0017
0018 namespace coro {
0019
0020 using SpillInfo = SmallMapVector<Value *, SmallVector<Instruction *, 2>, 8>;
0021
0022 struct AllocaInfo {
0023 AllocaInst *Alloca;
0024 DenseMap<Instruction *, std::optional<APInt>> Aliases;
0025 bool MayWriteBeforeCoroBegin;
0026 AllocaInfo(AllocaInst *Alloca,
0027 DenseMap<Instruction *, std::optional<APInt>> Aliases,
0028 bool MayWriteBeforeCoroBegin)
0029 : Alloca(Alloca), Aliases(std::move(Aliases)),
0030 MayWriteBeforeCoroBegin(MayWriteBeforeCoroBegin) {}
0031 };
0032
0033 void collectSpillsFromArgs(SpillInfo &Spills, Function &F,
0034 const SuspendCrossingInfo &Checker);
0035 void collectSpillsAndAllocasFromInsts(
0036 SpillInfo &Spills, SmallVector<AllocaInfo, 8> &Allocas,
0037 SmallVector<Instruction *, 4> &DeadInstructions,
0038 SmallVector<CoroAllocaAllocInst *, 4> &LocalAllocas, Function &F,
0039 const SuspendCrossingInfo &Checker, const DominatorTree &DT,
0040 const coro::Shape &Shape);
0041 void collectSpillsFromDbgInfo(SpillInfo &Spills, Function &F,
0042 const SuspendCrossingInfo &Checker);
0043
0044
0045
0046 void sinkSpillUsesAfterCoroBegin(const DominatorTree &DT,
0047 CoroBeginInst *CoroBegin,
0048 coro::SpillInfo &Spills,
0049 SmallVectorImpl<coro::AllocaInfo> &Allocas);
0050
0051
0052 BasicBlock::iterator getSpillInsertionPt(const coro::Shape &, Value *Def,
0053 const DominatorTree &DT);
0054
0055 }
0056
0057 }
0058
0059 #endif