Ejemplo n.º 1
0
    CodeNodePtr findMultiplyReferenced(
        CodeNodePtr node,
        const ReferenceMap& refs
    ) {
        assert(node);

        ReferenceMap::const_iterator it = refs.find(node);

        if (REN_DYNAMIC_CAST_PTR(p, CallCodeNode, node)) {
            if (it != refs.end() && it->second.size() > 1) {
                return p;
            }
        } else if (REN_DYNAMIC_CAST_PTR(p, IfCodeNode, node)) {
            if (it != refs.end() && it->second.size() > 1) {
                return p;
            }
        } else if (REN_DYNAMIC_CAST_PTR(p, NameCodeNode, node)) {
            // Do nothing.
        } else {
            assert(!"Unknown code node type");
        }

        CodeNodeList args = node->getChildren();
        for (size_t i = 0; i < args.size(); ++i) {
            CodeNodePtr c = findMultiplyReferenced(args[i], refs);
            if (c) {
                return c;
            }
        }
        return CodeNodePtr();
    }
Ejemplo n.º 2
0
void HexagonExpandCondsets::addRefToMap(RegisterRef RR, ReferenceMap &Map,
      unsigned Exec) {
  unsigned Mask = getMaskForSub(RR.Sub) | Exec;
  ReferenceMap::iterator F = Map.find(RR.Reg);
  if (F == Map.end())
    Map.insert(std::make_pair(RR.Reg, Mask));
  else
    F->second |= Mask;
}
Ejemplo n.º 3
0
bool HexagonExpandCondsets::isRefInMap(RegisterRef RR, ReferenceMap &Map,
      unsigned Exec) {
  ReferenceMap::iterator F = Map.find(RR.Reg);
  if (F == Map.end())
    return false;
  unsigned Mask = getMaskForSub(RR.Sub) | Exec;
  if (Mask & F->second)
    return true;
  return false;
}
Ejemplo n.º 4
0
static inline void writeReferences(const ReferenceMap &references, SymbolMap &symbols)
{
    const ReferenceMap::const_iterator end = references.end();
    for (ReferenceMap::const_iterator it = references.begin(); it != end; ++it) {
        const Set<Location> &refs = it->second;
        for (Set<Location>::const_iterator rit = refs.begin(); rit != refs.end(); ++rit) {
            CursorInfo &ci = symbols[*rit];
            ci.references.insert(it->first);
        }
    }
}