本文整理汇总了C++中machinebasicblock::iterator::operands_begin方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::operands_begin方法的具体用法?C++ iterator::operands_begin怎么用?C++ iterator::operands_begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类machinebasicblock::iterator
的用法示例。
在下文中一共展示了iterator::operands_begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceFrameIndexes
static void replaceFrameIndexes(MachineFunction &MF,
SmallVector<std::pair<int,int64_t>, 16> &FR) {
MachineFrameInfo *MFI = MF.getFrameInfo();
MBlazeFunctionInfo *MBlazeFI = MF.getInfo<MBlazeFunctionInfo>();
const SmallVector<std::pair<int,int64_t>, 16>::iterator FRB = FR.begin();
const SmallVector<std::pair<int,int64_t>, 16>::iterator FRE = FR.end();
SmallVector<std::pair<int,int64_t>, 16>::iterator FRI = FRB;
for (; FRI != FRE; ++FRI) {
MFI->RemoveStackObject(FRI->first);
int NFI = MFI->CreateFixedObject(4, FRI->second, true);
MBlazeFI->recordReplacement(FRI->first, NFI);
for (MachineFunction::iterator MB=MF.begin(), ME=MF.end(); MB!=ME; ++MB) {
MachineBasicBlock::iterator MBB = MB->begin();
const MachineBasicBlock::iterator MBE = MB->end();
for (; MBB != MBE; ++MBB) {
MachineInstr::mop_iterator MIB = MBB->operands_begin();
const MachineInstr::mop_iterator MIE = MBB->operands_end();
for (MachineInstr::mop_iterator MII = MIB; MII != MIE; ++MII) {
if (!MII->isFI() || MII->getIndex() != FRI->first) continue;
DEBUG(dbgs() << "FOUND FI#" << MII->getIndex() << "\n");
MII->setIndex(NFI);
}
}
}
}
}
示例2: addNewBlock
/// addNewBlock - Add a new basic block BB as an empty succcessor to DomBB. All
/// variables that are live out of DomBB will be marked as passing live through
/// BB.
void LiveVariables::addNewBlock(MachineBasicBlock *BB,
MachineBasicBlock *DomBB,
MachineBasicBlock *SuccBB) {
const unsigned NumNew = BB->getNumber();
SmallSet<unsigned, 16> Defs, Kills;
MachineBasicBlock::iterator BBI = SuccBB->begin(), BBE = SuccBB->end();
for (; BBI != BBE && BBI->isPHI(); ++BBI) {
// Record the def of the PHI node.
Defs.insert(BBI->getOperand(0).getReg());
// All registers used by PHI nodes in SuccBB must be live through BB.
for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2)
if (BBI->getOperand(i+1).getMBB() == BB)
getVarInfo(BBI->getOperand(i).getReg()).AliveBlocks.set(NumNew);
}
// Record all vreg defs and kills of all instructions in SuccBB.
for (; BBI != BBE; ++BBI) {
for (MachineInstr::mop_iterator I = BBI->operands_begin(),
E = BBI->operands_end(); I != E; ++I) {
if (I->isReg() && TargetRegisterInfo::isVirtualRegister(I->getReg())) {
if (I->isDef())
Defs.insert(I->getReg());
else if (I->isKill())
Kills.insert(I->getReg());
}
}
}
// Update info for all live variables
for (unsigned i = 0, e = MRI->getNumVirtRegs(); i != e; ++i) {
unsigned Reg = TargetRegisterInfo::index2VirtReg(i);
// If the Defs is defined in the successor it can't be live in BB.
if (Defs.count(Reg))
continue;
// If the register is either killed in or live through SuccBB it's also live
// through BB.
VarInfo &VI = getVarInfo(Reg);
if (Kills.count(Reg) || VI.AliveBlocks.test(SuccBB->getNumber()))
VI.AliveBlocks.set(NumNew);
}
}