本文整理汇总了C++中LPhi::setBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ LPhi::setBlock方法的具体用法?C++ LPhi::setBlock怎么用?C++ LPhi::setBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPhi
的用法示例。
在下文中一共展示了LPhi::setBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool
LBlock::init(TempAllocator& alloc)
{
// Count the number of LPhis we'll need.
size_t numLPhis = 0;
for (MPhiIterator i(block_->phisBegin()), e(block_->phisEnd()); i != e; ++i) {
MPhi* phi = *i;
switch (phi->type()) {
case MIRType::Value: numLPhis += BOX_PIECES; break;
case MIRType::Int64: numLPhis += INT64_PIECES; break;
default: numLPhis += 1; break;
}
}
// Allocate space for the LPhis.
if (!phis_.init(alloc, numLPhis))
return false;
// For each MIR phi, set up LIR phis as appropriate. We'll fill in their
// operands on each incoming edge, and set their definitions at the start of
// their defining block.
size_t phiIndex = 0;
size_t numPreds = block_->numPredecessors();
for (MPhiIterator i(block_->phisBegin()), e(block_->phisEnd()); i != e; ++i) {
MPhi* phi = *i;
MOZ_ASSERT(phi->numOperands() == numPreds);
int numPhis;
switch (phi->type()) {
case MIRType::Value: numPhis = BOX_PIECES; break;
case MIRType::Int64: numPhis = INT64_PIECES; break;
default: numPhis = 1; break;
}
for (int i = 0; i < numPhis; i++) {
LAllocation* inputs = alloc.allocateArray<LAllocation>(numPreds);
if (!inputs)
return false;
void* addr = &phis_[phiIndex++];
LPhi* lphi = new (addr) LPhi(phi, inputs);
lphi->setBlock(this);
}
}
return true;
}
示例2: new
bool
LBlock::init(TempAllocator& alloc)
{
// Count the number of LPhis we'll need.
size_t numLPhis = 0;
for (MPhiIterator i(block_->phisBegin()), e(block_->phisEnd()); i != e; ++i) {
MPhi* phi = *i;
numLPhis += (phi->type() == MIRType_Value) ? BOX_PIECES : 1;
}
// Allocate space for the LPhis.
if (!phis_.init(alloc, numLPhis))
return false;
// For each MIR phi, set up LIR phis as appropriate. We'll fill in their
// operands on each incoming edge, and set their definitions at the start of
// their defining block.
size_t phiIndex = 0;
size_t numPreds = block_->numPredecessors();
for (MPhiIterator i(block_->phisBegin()), e(block_->phisEnd()); i != e; ++i) {
MPhi* phi = *i;
MOZ_ASSERT(phi->numOperands() == numPreds);
int numPhis = (phi->type() == MIRType_Value) ? BOX_PIECES : 1;
for (int i = 0; i < numPhis; i++) {
void* array = alloc.allocateArray<sizeof(LAllocation)>(numPreds);
LAllocation* inputs = static_cast<LAllocation*>(array);
if (!inputs)
return false;
// MSVC 2015 cannot handle "new (&phis_[phiIndex++])"
void* addr = &phis_[phiIndex++];
LPhi* lphi = new (addr) LPhi(phi, inputs);
lphi->setBlock(this);
}
}
return true;
}