Пример #1
0
PhysReg
RegAlloc::getReg(const Location& loc) const {
  PhysReg reg = mapGet(m_contToRegMap, RegContent(loc), InvalidReg);
  ASSERT(reg != InvalidReg); // Usage error; didn't call allocInputRegs()?
  return reg;
}
Пример #2
0
const TransCFG::ArcPtrVec& TransCFG::outArcs(TransID id) const {
  assert(hasNode(id));
  size_t idx = mapGet(m_idToIdx, id);
  return m_nodeInfo[idx].outArcs();
}
Пример #3
0
int64_t TransCFG::weight(TransID id) const {
  assert(hasNode(id));
  size_t idx = mapGet(m_idToIdx, id);
  return m_nodeInfo[idx].weight();
}
Пример #4
0
static void *mapStrNGet(struct s_map *map, const char *str, const int len) {
	mapStrNPrepKey(map, str, len);
	return mapGet(map, key);
}
Пример #5
0
TransID PrologueToTransMap::get(FuncId funcId, int numArgs) const {
  auto pid = PrologueID(funcId, numArgs);
  return mapGet(m_prologueIdToTransId, pid, InvalidID);
}
Пример #6
0
void TypeConstraint::init() {
  if (UNLIKELY(s_typeNamesToTypes.empty())) {
    const struct Pair {
      const StringData* name;
      Type type;
    } pairs[] = {
      { makeStaticString("bool"),     { KindOfBoolean,
                                                   MetaType::Precise }},
      { makeStaticString("boolean"),  { KindOfBoolean,
                                                   MetaType::Precise }},

      { makeStaticString("int"),      { KindOfInt64,
                                                   MetaType::Precise }},
      { makeStaticString("integer"),  { KindOfInt64,
                                                   MetaType::Precise }},

      { makeStaticString("real"),     { KindOfDouble,
                                                   MetaType::Precise }},
      { makeStaticString("double"),   { KindOfDouble,
                                                   MetaType::Precise }},
      { makeStaticString("float"),    { KindOfDouble,
                                                   MetaType::Precise }},

      { makeStaticString("string"),   { KindOfString,
                                                   MetaType::Precise }},

      { makeStaticString("array"),    { KindOfArray,
                                                   MetaType::Precise }},

      { makeStaticString("resource"), { KindOfResource,
                                                   MetaType::Precise }},

      { makeStaticString("self"),     { KindOfObject,
                                                   MetaType::Self }},
      { makeStaticString("parent"),   { KindOfObject,
                                                   MetaType::Parent }},
      { makeStaticString("callable"), { KindOfObject,
                                                   MetaType::Callable }},
    };
    for (unsigned i = 0; i < sizeof(pairs) / sizeof(Pair); ++i) {
      s_typeNamesToTypes[pairs[i].name] = pairs[i].type;
    }
  }

  if (isTypeVar()) {
    // We kept the type variable type constraint to correctly check child
    // classes implementing abstract methods or interfaces.
    m_type.dt = KindOfInvalid;
    m_type.metatype = MetaType::Precise;
    return;
  }
  if (m_typeName && isExtended()) {
    assert((isNullable() || isSoft()) &&
           "Only nullable and soft extended type hints are implemented");
  }

  if (m_typeName == nullptr) {
    m_type.dt = KindOfInvalid;
    m_type.metatype = MetaType::Precise;
    return;
  }

  Type dtype;
  TRACE(5, "TypeConstraint: this %p type %s, nullable %d\n",
        this, m_typeName->data(), isNullable());
  if (!mapGet(s_typeNamesToTypes, m_typeName, &dtype) ||
      !(isHHType() || dtype.dt == KindOfArray ||
        dtype.metatype == MetaType::Parent ||
        dtype.metatype == MetaType::Self)) {
    TRACE(5, "TypeConstraint: this %p no such type %s, treating as object\n",
          this, m_typeName->data());
    m_type = { KindOfObject, MetaType::Precise };
    m_namedEntity = Unit::GetNamedEntity(m_typeName);
    TRACE(5, "TypeConstraint: NamedEntity: %p\n", m_namedEntity);
    return;
  }
  m_type = dtype;
  assert(m_type.dt != KindOfStaticString);
  assert(IMPLIES(isParent(), m_type.dt == KindOfObject));
  assert(IMPLIES(isSelf(), m_type.dt == KindOfObject));
  assert(IMPLIES(isCallable(), m_type.dt == KindOfObject));
}