liberty/lib/Utilities/InlineFunctionWithVmap.cpp
/// getInnerResumeDest - Get or create a target for the branch from ResumeInsts.
Get or create a target for the branch from ResumeInsts.
Get or create a target for the branch from ResumeInsts .
BasicBlock *InvokeInliningInfo::getInnerResumeDest() {
  if (InnerResumeDest) return InnerResumeDest;
  BasicBlock::iterator SplitPoint (CallerLPad);
  ++SplitPoint;
  InnerResumeDest =
    OuterResumeDest->splitBasicBlock(SplitPoint,
                                     OuterResumeDest->getName() + ".body");
  const unsigned PHICapacity = 2;
  BasicBlock::iterator InsertPoint = InnerResumeDest->begin();
  BasicBlock::iterator I = OuterResumeDest->begin();
  for (unsigned i = 0, e = UnwindDestPHIValues.size(); i != e; ++i, ++I) {
    PHINode *OuterPHI = cast<PHINode>(I);
    PHINode *InnerPHI = PHINode::Create(OuterPHI->getType(), PHICapacity,
                                        OuterPHI->getName() + ".lpad-body",
                                        &*InsertPoint);
    OuterPHI->replaceAllUsesWith(InnerPHI);
    InnerPHI->addIncoming(OuterPHI, OuterResumeDest);
  }
  InnerEHValuesPHI = PHINode::Create(CallerLPad->getType(), PHICapacity,
                                     "eh.lpad-body", &*InsertPoint);
  CallerLPad->replaceAllUsesWith(InnerEHValuesPHI);
  InnerEHValuesPHI->addIncoming(CallerLPad, OuterResumeDest);
  return InnerResumeDest;
}
BasicBlock * InvokeInliningInfo :: getInnerResumeDest ( ) { if ( InnerResumeDest ) return InnerResumeDest ; BasicBlock :: iterator SplitPoint ( CallerLPad ) ; ++ SplitPoint ; InnerResumeDest = OuterResumeDest -> splitBasicBlock ( SplitPoint , OuterResumeDest -> getName ( ) + " " ) ; const unsigned PHICapacity = 2 ; BasicBlock :: iterator InsertPoint = InnerResumeDest -> begin ( ) ; BasicBlock :: iterator I = OuterResumeDest -> begin ( ) ; for ( unsigned i = 0 , e = UnwindDestPHIValues . size ( ) ; i != e ; ++ i , ++ I ) { PHINode * OuterPHI = cast < PHINode > ( I ) ; PHINode * InnerPHI = PHINode :: Create ( OuterPHI -> getType ( ) , PHICapacity , OuterPHI -> getName ( ) + " " , & * InsertPoint ) ; OuterPHI -> replaceAllUsesWith ( InnerPHI ) ; InnerPHI -> addIncoming ( OuterPHI , OuterResumeDest ) ; } InnerEHValuesPHI = PHINode :: Create ( CallerLPad -> getType ( ) , PHICapacity , " " , & * InsertPoint ) ; CallerLPad -> replaceAllUsesWith ( InnerEHValuesPHI ) ; InnerEHValuesPHI -> addIncoming ( CallerLPad , OuterResumeDest ) ; return InnerResumeDest ; }
getInnerResumeDest - Get or create a target for the branch from ResumeInsts.
getInnerResumeDest - Get or create a target for the branch from ResumeInsts .
// Split the landing pad. // The number of incoming edges we expect to the inner landing pad. // Create corresponding new PHIs for all the PHIs in the outer landing pad. // Create a PHI for the exception values. // All done.