Example #1
0
File: ir-unit.cpp Project: 2bj/hhvm
SSATmp* IRUnit::findConst(Type type) {
  assert(type.isConst());
  IRInstruction inst(DefConst, BCMarker());
  inst.setTypeParam(type);
  if (SSATmp* tmp = m_constTable.lookup(&inst)) {
    assert(tmp->type().equals(type));
    return tmp;
  }
  return m_constTable.insert(cloneInstruction(&inst)->dst());
}
Example #2
0
SSATmp* IRFactory::findConst(ConstData& cdata, Type ctype) {
  IRInstruction inst(DefConst, BCMarker());
  inst.setExtra(&cdata);
  inst.setTypeParam(ctype);
  if (SSATmp* tmp = m_constTable.lookup(&inst)) {
    assert(tmp->type().equals(ctype));
    return tmp;
  }
  return m_constTable.insert(cloneInstruction(&inst)->dst());
}
Example #3
0
File: ir-unit.cpp Project: 2bj/hhvm
IRInstruction* IRUnit::defLabel(unsigned numDst, BCMarker marker) {
  IRInstruction inst(DefLabel, marker);
  IRInstruction* label = cloneInstruction(&inst);
  if (numDst > 0) {
    SSATmp* dsts = (SSATmp*) m_arena.alloc(numDst * sizeof(SSATmp));
    for (unsigned i = 0; i < numDst; ++i) {
      new (&dsts[i]) SSATmp(m_nextOpndId++, label);
    }
    label->setDsts(numDst, dsts);
  }
  return label;
}
Example #4
0
IRInstruction* IRUnit::defLabel(unsigned numDst, BCMarker marker,
                                const jit::vector<uint32_t>& producedRefs) {
  IRInstruction inst(DefLabel, marker);
  IRInstruction* label = cloneInstruction(&inst);
  always_assert(producedRefs.size() == numDst);
  m_labelRefs[label] = producedRefs;
  if (numDst > 0) {
    SSATmp* dsts = (SSATmp*) m_arena.alloc(numDst * sizeof(SSATmp));
    for (unsigned i = 0; i < numDst; ++i) {
      new (&dsts[i]) SSATmp(m_nextOpndId++, label);
    }
    label->setDsts(numDst, dsts);
  }
  return label;
}