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


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

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


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

示例1: disassemble

MachineFunction* Disassembler::disassemble(unsigned Address) {
  MachineFunction *MF = getOrCreateFunction(Address);

  if (MF->size() == 0) {
    // Decode basic blocks until end of function
    unsigned Size = 0;
    MachineBasicBlock *MBB;
    do {
      unsigned MBBSize = 0;
      MBB = decodeBasicBlock(Address+Size, MF, MBBSize);
      Size += MBBSize;
    } while (Address+Size < CurSectionEnd && MBB->size() > 0
      && !(MBB->instr_rbegin()->isReturn()));
    if (Address+Size < CurSectionEnd && MBB->size() > 0) {
      // FIXME: This can be shoved into the loop above to improve performance
      MachineFunction *NextMF =
        getNearestFunction(getDebugOffset(MBB->instr_rbegin()->getDebugLoc()));
      if (NextMF != NULL) {
        Functions.erase(
          getDebugOffset(NextMF->begin()->instr_begin()->getDebugLoc()));
      }
    }
  }

  Functions[Address] = MF;
  return MF;
}
开发者ID:SAB2012,项目名称:fracture,代码行数:27,代码来源:Disassembler.cpp

示例2: decodeBasicBlock

MachineBasicBlock* Disassembler::decodeBasicBlock(unsigned Address,
  MachineFunction* MF, unsigned &Size) {
  assert(MF && "Unable to decode basic block without Machine Function!");

  uint64_t MFLoc = MF->getFunctionNumber(); // FIXME: Horrible, horrible hack
  uint64_t Off = Address-MFLoc;
  std::stringstream MBBName;
  MBBName << MF->getName().str() << "+" << Off;

  // Dummy holds the name.
  BasicBlock *Dummy = BasicBlock::Create(*MC->getContext(), MBBName.str());
  MachineBasicBlock *MBB = MF->CreateMachineBasicBlock(Dummy);
  MF->push_back(MBB);

  // NOTE: Might also need SectAddr...
  Size = 0;
  while (Address+Size < (unsigned) CurSectionEnd) {
    unsigned CurAddr = Address+Size;
    Size += std::max(unsigned(1), decodeInstruction(CurAddr, MBB));
    MachineInstr* MI = NULL;
    if (MBB->size() != 0) {
      MI = &(*MBB->instr_rbegin());
      MachineInstructions[CurAddr] = MI;
    }
    if (MI != NULL && MI->isTerminator()) {
      break;
    }
  }

  if (Address >= CurSectionEnd) {
    printInfo("Reached end of current section!");
  }

  return MBB;
}
开发者ID:SAB2012,项目名称:fracture,代码行数:35,代码来源:Disassembler.cpp


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