当前位置: 首页>>代码示例>>C++>>正文


C++ MachineBasicBlock::isReturnBlock方法代码示例

本文整理汇总了C++中MachineBasicBlock::isReturnBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ MachineBasicBlock::isReturnBlock方法的具体用法?C++ MachineBasicBlock::isReturnBlock怎么用?C++ MachineBasicBlock::isReturnBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MachineBasicBlock的用法示例。


在下文中一共展示了MachineBasicBlock::isReturnBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateSaveRestoreBlocks

/// Compute the sets of entry and return blocks for saving and restoring
/// callee-saved registers, and placing prolog and epilog code.
void PEI::calculateSaveRestoreBlocks(MachineFunction &MF) {
  const MachineFrameInfo &MFI = MF.getFrameInfo();

  // Even when we do not change any CSR, we still want to insert the
  // prologue and epilogue of the function.
  // So set the save points for those.

  // Use the points found by shrink-wrapping, if any.
  if (MFI.getSavePoint()) {
    SaveBlocks.push_back(MFI.getSavePoint());
    assert(MFI.getRestorePoint() && "Both restore and save must be set");
    MachineBasicBlock *RestoreBlock = MFI.getRestorePoint();
    // If RestoreBlock does not have any successor and is not a return block
    // then the end point is unreachable and we do not need to insert any
    // epilogue.
    if (!RestoreBlock->succ_empty() || RestoreBlock->isReturnBlock())
      RestoreBlocks.push_back(RestoreBlock);
    return;
  }

  // Save refs to entry and return blocks.
  SaveBlocks.push_back(&MF.front());
  for (MachineBasicBlock &MBB : MF) {
    if (MBB.isEHFuncletEntry())
      SaveBlocks.push_back(&MBB);
    if (MBB.isReturnBlock())
      RestoreBlocks.push_back(&MBB);
  }
}
开发者ID:Lucretia,项目名称:llvm,代码行数:31,代码来源:PrologEpilogInserter.cpp

示例2: addLiveOuts

void LivePhysRegs::addLiveOuts(const MachineBasicBlock &MBB) {
  const MachineFunction &MF = *MBB.getParent();
  const MachineFrameInfo &MFI = *MF.getFrameInfo();
  if (MFI.isCalleeSavedInfoValid()) {
    if (MBB.isReturnBlock()) {
      // The return block has no successors whose live-ins we could merge
      // below. So instead we add the callee saved registers manually.
      for (const MCPhysReg *I = TRI->getCalleeSavedRegs(&MF); *I; ++I)
        addReg(*I);
    } else {
      addPristines(*this, MF, MFI, *TRI);
    }
  }

  addLiveOutsNoPristines(MBB);
}
开发者ID:CSI-LLVM,项目名称:llvm,代码行数:16,代码来源:LivePhysRegs.cpp

示例3: addLiveOuts

void LiveRegUnits::addLiveOuts(const MachineBasicBlock &MBB) {
  const MachineFunction &MF = *MBB.getParent();

  addPristines(MF);

  // To get the live-outs we simply merge the live-ins of all successors.
  for (const MachineBasicBlock *Succ : MBB.successors())
    addBlockLiveIns(*this, *Succ);

  // For the return block: Add all callee saved registers.
  if (MBB.isReturnBlock()) {
    const MachineFrameInfo &MFI = MF.getFrameInfo();
    if (MFI.isCalleeSavedInfoValid())
      addCalleeSavedRegs(*this, MF);
  }
}
开发者ID:alex-t,项目名称:llvm,代码行数:16,代码来源:LiveRegUnits.cpp

示例4: calculateSaveRestoreBlocks

/// Compute the sets of entry and return blocks for saving and restoring
/// callee-saved registers, and placing prolog and epilog code.
void PEI::calculateSaveRestoreBlocks(MachineFunction &Fn) {
  MachineFrameInfo &MFI = Fn.getFrameInfo();
  const TargetFrameLowering *TFI = Fn.getSubtarget().getFrameLowering();

  // Even when we do not change any CSR, we still want to insert the
  // prologue and epilogue of the function.
  // So set the save points for those.

  // Use the points found by shrink-wrapping, if any.
  if (MFI.getSavePoint()) {
    SaveBlocks.push_back(MFI.getSavePoint());
    assert(MFI.getRestorePoint() && "Both restore and save must be set");
    MachineBasicBlock *RestoreBlock = MFI.getRestorePoint();
    // If RestoreBlock does not have any successor and is not a return block
    // then the end point is unreachable and we do not need to insert any
    // epilogue.
    if (!RestoreBlock->succ_empty() || RestoreBlock->isReturnBlock())
      RestoreBlocks.push_back(RestoreBlock);

    // If we are adding return protectors ensure we can find a free register
    if (MFI.hasReturnProtector() &&
        !TFI->determineReturnProtectorTempRegister(Fn, SaveBlocks, RestoreBlocks)) {
      // Shrinkwrapping will prevent finding a free register
      SaveBlocks.clear();
      RestoreBlocks.clear();
      MFI.setSavePoint(nullptr);
      MFI.setRestorePoint(nullptr);
    } else {
      return;
    }
  }

  // Save refs to entry and return blocks.
  SaveBlocks.push_back(&Fn.front());
  for (MachineBasicBlock &MBB : Fn) {
    if (MBB.isEHFuncletEntry())
      SaveBlocks.push_back(&MBB);
    if (MBB.isReturnBlock())
      RestoreBlocks.push_back(&MBB);
  }

  if (MFI.hasReturnProtector())
    TFI->determineReturnProtectorTempRegister(Fn, SaveBlocks, RestoreBlocks);
}
开发者ID:a565109863,项目名称:src,代码行数:46,代码来源:PrologEpilogInserter.cpp


注:本文中的MachineBasicBlock::isReturnBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。