Beispiel #1
0
bool IRInstruction::canCSE() const {
  auto canCSE = opcodeHasFlags(op(), CanCSE);
  // Make sure that instructions that are CSE'able can't consume reference
  // counts.
  assert(!canCSE || !consumesReferences());
  return canCSE;
}
Beispiel #2
0
bool IRInstruction::canCSE() const {
  auto canCSE = opcodeHasFlags(op(), CanCSE);
  // Make sure that instructions that are CSE'able can't produce a reference
  // count or consume reference counts. CheckType/AssertType are special
  // because they can refine a maybeCounted type to a notCounted type, so they
  // logically consume and produce a reference without doing any work.
  assert(!canCSE || !consumesReferences() ||
         m_op == CheckType || m_op == AssertType);
  return canCSE && !mayReenterHelper();
}
Beispiel #3
0
bool IRInstruction::isEssential() const {
  Opcode opc = op();
  if (opc == DecRefNZ) {
    // If the source of a DecRefNZ is not an IncRef, mark it as essential
    // because we won't remove its source as well as itself.
    // If the ref count optimization is turned off, mark all DecRefNZ as
    // essential.
    if (!RuntimeOption::EvalHHIREnableRefCountOpt ||
        src(0)->inst()->op() != IncRef) {
      return true;
    }
  }
  return isControlFlow() ||
         opcodeHasFlags(opc, Essential) ||
         mayReenterHelper();
}
Beispiel #4
0
bool IRInstruction::mayModifyRefs() const {
  Opcode opc = op();
  // DecRefNZ does not have side effects other than decrementing the ref
  // count. Therefore, its MayModifyRefs should be false.
  if (opc == DecRef) {
    auto type = src(0)->type();
    if (isControlFlow()) {
      // If the decref has a target label, then it exits if the destructor
      // has to be called, so it does not have any side effects on the main
      // trace.
      return false;
    }
    if (!type.canRunDtor()) {
      return false;
    }
  }
  return opcodeHasFlags(opc, MayModifyRefs) || mayReenterHelper();
}
Beispiel #5
0
bool IRInstruction::isPassthrough() const {
  return opcodeHasFlags(op(), Passthrough);
}
Beispiel #6
0
bool IRInstruction::isTerminal() const {
  return opcodeHasFlags(op(), Terminal);
}
Beispiel #7
0
bool IRInstruction::isEssential() const {
  return isControlFlow() ||
         opcodeHasFlags(op(), Essential);
}
Beispiel #8
0
bool MInstrEffects::supported(Opcode op) {
  return opcodeHasFlags(op, MInstrProp | MInstrElem);
}
Beispiel #9
0
bool IRInstruction::producesReference(int dstNo) const {
  return opcodeHasFlags(op(), ProducesRC);
}
Beispiel #10
0
bool IRInstruction::naryDst() const {
  return opcodeHasFlags(op(), NaryDest | ModifiesStack);
}
Beispiel #11
0
bool IRInstruction::hasMainDst() const {
  return opcodeHasFlags(op(), HasDest);
}
Beispiel #12
0
bool IRInstruction::hasMemEffects() const {
  return opcodeHasFlags(op(), MemEffects) || mayReenterHelper();
}
Beispiel #13
0
bool IRInstruction::mayRaiseError() const {
  return opcodeHasFlags(op(), MayRaiseError) || mayReenterHelper();
}
Beispiel #14
0
// minstrBaseIdx returns the src index for inst's base operand.
int minstrBaseIdx(Opcode opc) {
  return opcodeHasFlags(opc, MInstrProp) ? 0 :
         opcodeHasFlags(opc, MInstrElem) ? 0 :
         bad_value<int>();
}
Beispiel #15
0
bool IRInstruction::killsSources() const {
  return opcodeHasFlags(op(), KillsSources);
}
Beispiel #16
0
bool IRInstruction::modifiesStack() const {
  return opcodeHasFlags(op(), ModifiesStack);
}
Beispiel #17
0
bool IRInstruction::mayRaiseError() const {
  return opcodeHasFlags(op(), MayRaiseError);
}
Beispiel #18
0
bool IRInstruction::hasDst() const {
  return opcodeHasFlags(op(), HasDest) &&
    !opcodeHasFlags(op(), ModifiesStack);
}
Beispiel #19
0
bool hasEdges(Opcode opcode) {
  return opcodeHasFlags(opcode, Branch | MayRaiseError);
}
Beispiel #20
0
bool IRInstruction::isNative() const {
  return opcodeHasFlags(op(), CallsNative);
}
Beispiel #21
0
bool opHasExtraData(Opcode op) {
  return opcodeHasFlags(op, HasExtra);
}
Beispiel #22
0
bool IRInstruction::consumesReferences() const {
  return opcodeHasFlags(op(), ConsumesRC);
}
Beispiel #23
0
Opcode getStackModifyingOpcode(Opcode opc) {
  assert(opcodeHasFlags(opc, HasStackVersion));
  opc = Opcode(uint64_t(opc) + 1);
  assert(opcodeHasFlags(opc, ModifiesStack));
  return opc;
}