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


C++ MInstruction::opName方法代码示例

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


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

示例1: JitSpew

static void
VisitLoopBlock(MBasicBlock *block, MBasicBlock *header, MInstruction *hoistPoint, bool hasCalls)
{
    for (auto insIter(block->begin()), insEnd(block->end()); insIter != insEnd; ) {
        MInstruction *ins = *insIter++;

        if (!IsHoistable(ins, header, hasCalls)) {
#ifdef DEBUG
            if (IsHoistableIgnoringDependency(ins, hasCalls)) {
                JitSpew(JitSpew_LICM, "    %s%u isn't hoistable due to dependency on %s%u",
                        ins->opName(), ins->id(),
                        ins->dependency()->opName(), ins->dependency()->id());
            }
#endif
            continue;
        }

        // Don't hoist a cheap constant if it doesn't enable us to hoist one of
        // its uses. We want those instructions as close as possible to their
        // use, to minimize register pressure.
        if (RequiresHoistedUse(ins, hasCalls)) {
            JitSpew(JitSpew_LICM, "    %s%u will be hoisted only if its users are",
                    ins->opName(), ins->id());
            continue;
        }

        // Hoist operands which were too cheap to hoist on their own.
        MoveDeferredOperands(ins, hoistPoint, hasCalls);

        JitSpew(JitSpew_LICM, "    Hoisting %s%u", ins->opName(), ins->id());

        // Move the instruction to the hoistPoint.
        block->moveBefore(hoistPoint, ins);
    }
}
开发者ID:martasect,项目名称:gecko,代码行数:35,代码来源:LICM.cpp

示例2: MoveDeferredOperands

// In preparation for hoisting an instruction, hoist any of its operands which
// were too cheap to hoist on their own.
static void
MoveDeferredOperands(MInstruction* ins, MInstruction* hoistPoint, bool hasCalls)
{
    // If any of our operands were waiting for a user to be hoisted, make a note
    // to hoist them.
    for (size_t i = 0, e = ins->numOperands(); i != e; ++i) {
        MDefinition* op = ins->getOperand(i);
        if (!IsInLoop(op))
            continue;
        MOZ_ASSERT(RequiresHoistedUse(op, hasCalls),
                   "Deferred loop-invariant operand is not cheap");
        MInstruction* opIns = op->toInstruction();

        // Recursively move the operands. Note that the recursion is bounded
        // because we require RequiresHoistedUse to be set at each level.
        MoveDeferredOperands(opIns, hoistPoint, hasCalls);

#ifdef DEBUG
        JitSpew(JitSpew_LICM, "    Hoisting %s%u (now that a user will be hoisted)",
                opIns->opName(), opIns->id());
#endif

        opIns->block()->moveBefore(hoistPoint, opIns);
    }
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:27,代码来源:LICM.cpp

示例3: AnalyzeAdd

// Fold AddIs with one variable and two or more constants into one AddI.
static void AnalyzeAdd(TempAllocator& alloc, MAdd* add) {
  if (add->specialization() != MIRType::Int32 || add->isRecoveredOnBailout()) {
    return;
  }

  if (!add->hasUses()) {
    return;
  }

  JitSpew(JitSpew_FLAC, "analyze add: %s%u", add->opName(), add->id());

  SimpleLinearSum sum = ExtractLinearSum(add);
  if (sum.constant == 0 || !sum.term) {
    return;
  }

  // Determine which operand is the constant.
  int idx = add->getOperand(0)->isConstant() ? 0 : 1;
  if (add->getOperand(idx)->isConstant()) {
    // Do not replace an add where the outcome is the same add instruction.
    MOZ_ASSERT(add->getOperand(idx)->toConstant()->type() == MIRType::Int32);
    if (sum.term == add->getOperand(1 - idx) ||
        sum.constant == add->getOperand(idx)->toConstant()->toInt32()) {
      return;
    }
  }

  MInstruction* rhs = MConstant::New(alloc, Int32Value(sum.constant));
  add->block()->insertBefore(add, rhs);

  MAdd* addNew =
      MAdd::New(alloc, sum.term, rhs, MIRType::Int32, add->truncateKind());

  add->replaceAllLiveUsesWith(addNew);
  add->block()->insertBefore(add, addNew);
  JitSpew(JitSpew_FLAC, "replaced with: %s%u", addNew->opName(), addNew->id());
  JitSpew(JitSpew_FLAC, "and constant: %s%u (%d)", rhs->opName(), rhs->id(),
          sum.constant);

  // Mark the stale nodes as RecoveredOnBailout since the Sink pass has
  // been run before this pass. DCE will then remove the unused nodes.
  markNodesAsRecoveredOnBailout(add);
}
开发者ID:servo,项目名称:mozjs,代码行数:44,代码来源:FoldLinearArithConstants.cpp

示例4: remainingIterationsInequality

void
LoopUnroller::go(LoopIterationBound *bound)
{
    // For now we always unroll loops the same number of times.
    static const size_t UnrollCount = 10;

    JitSpew(JitSpew_Unrolling, "Attempting to unroll loop");

    header = bound->header;

    // UCE might have determined this isn't actually a loop.
    if (!header->isLoopHeader())
        return;

    backedge = header->backedge();
    oldPreheader = header->loopPredecessor();

    JS_ASSERT(oldPreheader->numSuccessors() == 1);

    // Only unroll loops with two blocks: an initial one ending with the
    // bound's test, and the body ending with the backedge.
    MTest *test = bound->test;
    if (header->lastIns() != test)
        return;
    if (test->ifTrue() == backedge) {
        if (test->ifFalse()->id() <= backedge->id())
            return;
    } else if (test->ifFalse() == backedge) {
        if (test->ifTrue()->id() <= backedge->id())
            return;
    } else {
        return;
    }
    if (backedge->numPredecessors() != 1 || backedge->numSuccessors() != 1)
        return;
    JS_ASSERT(backedge->phisEmpty());

    MBasicBlock *bodyBlocks[] = { header, backedge };

    // All instructions in the header and body must be clonable.
    for (size_t i = 0; i < ArrayLength(bodyBlocks); i++) {
        MBasicBlock *block = bodyBlocks[i];
        for (MInstructionIterator iter(block->begin()); iter != block->end(); iter++) {
            MInstruction *ins = *iter;
            if (ins->canClone())
                continue;
            if (ins->isTest() || ins->isGoto() || ins->isInterruptCheck())
                continue;
#ifdef DEBUG
            JitSpew(JitSpew_Unrolling, "Aborting: can't clone instruction %s", ins->opName());
#endif
            return;
        }
    }

    // Compute the linear inequality we will use for exiting the unrolled loop:
    //
    // iterationBound - iterationCount - UnrollCount >= 0
    //
    LinearSum remainingIterationsInequality(bound->boundSum);
    if (!remainingIterationsInequality.add(bound->currentSum, -1))
        return;
    if (!remainingIterationsInequality.add(-int32_t(UnrollCount)))
        return;

    // Terms in the inequality need to be either loop invariant or phis from
    // the original header.
    for (size_t i = 0; i < remainingIterationsInequality.numTerms(); i++) {
        MDefinition *def = remainingIterationsInequality.term(i).term;
        if (def->block()->id() < header->id())
            continue;
        if (def->block() == header && def->isPhi())
            continue;
        return;
    }

    // OK, we've checked everything, now unroll the loop.

    JitSpew(JitSpew_Unrolling, "Unrolling loop");

    // The old preheader will go before the unrolled loop, and the old loop
    // will need a new empty preheader.
    CompileInfo &info = oldPreheader->info();
    if (header->trackedSite().pc()) {
        unrolledHeader =
            MBasicBlock::New(graph, nullptr, info,
                             oldPreheader, header->trackedSite(), MBasicBlock::LOOP_HEADER);
        unrolledBackedge =
            MBasicBlock::New(graph, nullptr, info,
                             unrolledHeader, backedge->trackedSite(), MBasicBlock::NORMAL);
        newPreheader =
            MBasicBlock::New(graph, nullptr, info,
                             unrolledHeader, oldPreheader->trackedSite(), MBasicBlock::NORMAL);
    } else {
        unrolledHeader = MBasicBlock::NewAsmJS(graph, info, oldPreheader, MBasicBlock::LOOP_HEADER);
        unrolledBackedge = MBasicBlock::NewAsmJS(graph, info, unrolledHeader, MBasicBlock::NORMAL);
        newPreheader = MBasicBlock::NewAsmJS(graph, info, unrolledHeader, MBasicBlock::NORMAL);
    }

    unrolledHeader->discardAllResumePoints();
//.........这里部分代码省略.........
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:101,代码来源:LoopUnroller.cpp


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