#include "SuspendCrossingInfo.h"
#define DEBUG_TYPE …
namespace llvm {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
static std::string getBasicBlockLabel(const BasicBlock *BB) {
if (BB->hasName())
return BB->getName().str();
std::string S;
raw_string_ostream OS(S);
BB->printAsOperand(OS, false);
return OS.str().substr(1);
}
LLVM_DUMP_METHOD void SuspendCrossingInfo::dump(
StringRef Label, BitVector const &BV,
const ReversePostOrderTraversal<Function *> &RPOT) const {
dbgs() << Label << ":";
for (const BasicBlock *BB : RPOT) {
auto BBNo = Mapping.blockToIndex(BB);
if (BV[BBNo])
dbgs() << " " << getBasicBlockLabel(BB);
}
dbgs() << "\n";
}
LLVM_DUMP_METHOD void SuspendCrossingInfo::dump() const {
if (Block.empty())
return;
BasicBlock *const B = Mapping.indexToBlock(0);
Function *F = B->getParent();
ReversePostOrderTraversal<Function *> RPOT(F);
for (const BasicBlock *BB : RPOT) {
auto BBNo = Mapping.blockToIndex(BB);
dbgs() << getBasicBlockLabel(BB) << ":\n";
dump(" Consumes", Block[BBNo].Consumes, RPOT);
dump(" Kills", Block[BBNo].Kills, RPOT);
}
dbgs() << "\n";
}
#endif
bool SuspendCrossingInfo::hasPathCrossingSuspendPoint(BasicBlock *From,
BasicBlock *To) const { … }
bool SuspendCrossingInfo::hasPathOrLoopCrossingSuspendPoint(
BasicBlock *From, BasicBlock *To) const { … }
template <bool Initialize>
bool SuspendCrossingInfo::computeBlockData(
const ReversePostOrderTraversal<Function *> &RPOT) { … }
SuspendCrossingInfo::SuspendCrossingInfo(
Function &F, const SmallVectorImpl<AnyCoroSuspendInst *> &CoroSuspends,
const SmallVectorImpl<AnyCoroEndInst *> &CoroEnds)
: … { … }
}