[WinEH] Rename CatchReturnInst::getParentPad, NFC

Summary:
Rename to getCatchSwitchParentPad, to make it more clear which ancestor
the "parent" in question is.  Add a comment pointing out the key feature
that the returned pad indicates which funclet contains the successor
block.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16222

llvm-svn: 257933
This commit is contained in:
Joseph Tremoulet 2016-01-15 21:16:19 +00:00
parent 2ba12953d2
commit 44b3f961e1
4 changed files with 7 additions and 5 deletions

View File

@ -4152,7 +4152,9 @@ public:
}
unsigned getNumSuccessors() const { return 1; }
Value *getParentPad() const {
/// Get the parentPad of this catchret's catchpad's catchswitch.
/// The successor block is implicitly a member of this funclet.
Value *getCatchSwitchParentPad() const {
return getCatchPad()->getCatchSwitch()->getParentPad();
}

View File

@ -92,7 +92,7 @@ DenseMap<BasicBlock *, ColorVector> llvm::colorEHFunclets(Function &F) {
BasicBlock *SuccColor = Color;
TerminatorInst *Terminator = Visiting->getTerminator();
if (auto *CatchRet = dyn_cast<CatchReturnInst>(Terminator)) {
Value *ParentPad = CatchRet->getParentPad();
Value *ParentPad = CatchRet->getCatchSwitchParentPad();
if (isa<ConstantTokenNone>(ParentPad))
SuccColor = EntryBlock;
else

View File

@ -1206,7 +1206,7 @@ void SelectionDAGBuilder::visitCatchRet(const CatchReturnInst &I) {
// This will be used by the FuncletLayout pass to determine how to order the
// BB's.
// A 'catchret' returns to the outer scope's color.
Value *ParentPad = I.getParentPad();
Value *ParentPad = I.getCatchSwitchParentPad();
const BasicBlock *SuccessorColor;
if (isa<ConstantTokenNone>(ParentPad))
SuccessorColor = &FuncInfo.Fn->getEntryBlock();

View File

@ -787,7 +787,7 @@ void WinEHPrepare::cloneCommonBlocks(Function &F) {
FixupCatchrets.clear();
for (BasicBlock *Pred : predecessors(OldBlock))
if (auto *CatchRet = dyn_cast<CatchReturnInst>(Pred->getTerminator()))
if (CatchRet->getParentPad() == FuncletToken)
if (CatchRet->getCatchSwitchParentPad() == FuncletToken)
FixupCatchrets.push_back(CatchRet);
for (CatchReturnInst *CatchRet : FixupCatchrets)
@ -802,7 +802,7 @@ void WinEHPrepare::cloneCommonBlocks(Function &F) {
bool EdgeTargetsFunclet;
if (auto *CRI =
dyn_cast<CatchReturnInst>(IncomingBlock->getTerminator())) {
EdgeTargetsFunclet = (CRI->getParentPad() == FuncletToken);
EdgeTargetsFunclet = (CRI->getCatchSwitchParentPad() == FuncletToken);
} else {
ColorVector &IncomingColors = BlockColors[IncomingBlock];
assert(!IncomingColors.empty() && "Block not colored!");