本文整理汇总了C++中BasicBlock::assign方法的典型用法代码示例。如果您正苦于以下问题:C++ BasicBlock::assign方法的具体用法?C++ BasicBlock::assign怎么用?C++ BasicBlock::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasicBlock
的用法示例。
在下文中一共展示了BasicBlock::assign方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runOnBlock
void MachineToVIRInstructionTranslationPass::runOnBlock(BasicBlock& block)
{
TranslationRule::InstructionVector newInstructions;
hydrazine::log("MachineToVIRInstructionTranslationPass")
<< "Running on basic block " << block.name() << "\n";
// parallel-for-all
for(auto instruction : block)
{
hydrazine::log("MachineToVIRInstructionTranslationPass")
<< " For instruction: " << instruction->toString() << "\n";
// don't translate instructions that are already in VIR
if(!instruction->isMachineInstruction())
{
hydrazine::log("MachineToVIRInstructionTranslationPass")
<< " skipped, already VIR.\n";
newInstructions.push_back(instruction->clone());
continue;
}
auto rule = _translationRules.find(instruction->opcodeString());
// don't translate instructions with missing rules
if(rule == _translationRules.end())
{
hydrazine::log("MachineToVIRInstructionTranslationPass")
<< " skipped, no rule.\n";
newInstructions.push_back(instruction->clone());
continue;
}
auto instructions = rule->second->translateMachineInstruction(
static_cast<machine::Instruction*>(instruction));
// parallel-gather
newInstructions.insert(newInstructions.end(), instructions.begin(),
instructions.end());
}
block.assign(newInstructions.begin(), newInstructions.end());
}
示例2: _lowerBlock
void TranslationTableInstructionSelectionPass::_lowerBlock(BasicBlock& block)
{
hydrazine::log("TranslationTableInstructionSelectionPass")
<< "Running on basic block " << block.name() << "\n";
auto machineModel = compiler::Compiler::getSingleton()->getMachineModel();
BasicBlock::InstructionList loweredInstructions;
auto translationTable = machineModel->translationTable();
// Parallel for all and final gather
for(auto instruction : block)
{
lowerInstruction(loweredInstructions, instruction, translationTable);
}
// Swap out the block contents, deallocate it
block.clear();
block.assign(loweredInstructions.begin(), loweredInstructions.end());
}