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


C++ ControlFlowGraph::bitWidth方法代码示例

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


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

示例1: updateParams

void LiveDict::updateParams() {
  ControlFlowGraph *g = m_am.graph();
  ControlBlock *b = g->getDfBlock(1);
  size_t width = g->bitWidth();

  BitOps::Bits *avlin = b->getRow(DataFlow::PAvailIn);
  BitOps::Bits *dieout = m_am.graph()->getTempBits(0);
  BitOps::set(width, dieout, 0);
  for (int i = size(); i--; ) {
    if (ExpressionPtr e = get(i)) {
      always_assert(e->is(Expression::KindOfSimpleVariable));
      Symbol *sym = static_pointer_cast<SimpleVariable>(e)->getSymbol();
      if (sym) {
        if (sym->isParameter() || sym->isClosureVar() || e->isThis()) {
          BitOps::set_bit(e->getCanonID(), avlin, true);
        }
        if (sym->isNeeded() || sym->isReferenced()) {
          BitOps::set_bit(e->getCanonID(), dieout, true);
        }
      }
    }
  }
  for (int i = g->getNumBlocks(); i; i--) {
    b = g->getDfBlock(i);
    if (!b->out_size()) {
      BitOps::bit_or(width, b->getRow(DataFlow::PDieOut),
                     b->getRow(DataFlow::PDieOut), dieout);
    }
  }
}
开发者ID:7755373049,项目名称:hiphop-php,代码行数:30,代码来源:live_dict.cpp

示例2: ComputeAvailable

void DataFlow::ComputeAvailable(const ControlFlowGraph &g) {
  int num = g.getNumBlocks();
  bool changed;
  BitOps::Bits *tmp1 = g.getTempBits(0);
  bool hasAltered = g.rowExists(Altered);
  size_t width = g.bitWidth();
  bool firstTime = true;

  do {
    changed = false;

    for (int i = 1; i <= num; i++) {
      ControlBlock *b = g.getDfBlock(i);
      std::pair<in_edge_iterator, in_edge_iterator> vi =
        in_edges(b, g);
      BitOps::Bits *ain = b->getRow(AvailIn);

      if (vi.first != vi.second) {
        ControlBlock *p = source(*vi.first, g);
        if (++vi.first != vi.second) {
          if (!changed) BitOps::bit_copy(width, tmp1, ain);
          BitOps::bit_and(width, ain,
                          p->getRow(AvailOut),
                          source(*vi.first, g)->getRow(AvailOut));
          while (++vi.first != vi.second) {
            p = source(*vi.first, g);
            BitOps::bit_and(width, ain, ain, p->getRow(AvailOut));
          }
          if (!changed) changed = !BitOps::bit_equal(width, tmp1, ain);
        } else {
          if (!changed) {
            changed = !BitOps::bit_equal(width, ain, p->getRow(AvailOut));
          }
          BitOps::bit_copy(width, ain, p->getRow(AvailOut));
        }
      } else if (firstTime) {
        // available defaults to all 1s
        // if there are no preds, set to all 0s
        BitOps::set(width, ain, 0);
      }

      BitOps::Bits *aout = b->getRow(AvailOut);
      if (!changed) BitOps::bit_copy(width, tmp1, aout);
      BitOps::Bits *avl = b->getRow(Available);
      if (hasAltered) {
        BitOps::Bits *alt = b->getRow(Altered);
        BitOps::bit_andc_or(width, aout, ain, alt, avl);
      } else {
        BitOps::bit_or(width, aout, ain, avl);
      }
      if (!changed) changed = !BitOps::bit_equal(width, tmp1, aout);
    }
    firstTime = false;
  } while (changed);
}
开发者ID:rherbrich,项目名称:hiphop-php,代码行数:55,代码来源:data_flow.cpp

示例3: beginBlock

void Dictionary::beginBlock(ControlBlock *b) {
  ControlFlowGraph *g = m_am.graph();
  always_assert(g);

  m_width = g->bitWidth();
  m_altered = b->getRow(DataFlow::Altered);
  m_available = g->rowExists(DataFlow::Available) ?
    b->getRow(DataFlow::Available) : 0;
  m_anticipated = g->rowExists(DataFlow::Anticipated) ?
    b->getRow(DataFlow::Anticipated) : 0;
}
开发者ID:524777134,项目名称:hiphop-php,代码行数:11,代码来源:dictionary.cpp

示例4: ComputeAnticipated

void DataFlow::ComputeAnticipated(const ControlFlowGraph &g) {
  int num = g.getNumBlocks();
  bool changed;
  BitOps::Bits *tmp1 = g.getTempBits(0);
  bool hasAltered = g.rowExists(Altered);
  size_t width = g.bitWidth();
  bool firstTime = true;

  do {
    changed = false;

    for (int i = num; i ; i--) {
      ControlBlock *b = g.getDfBlock(i);
      std::pair<out_edge_iterator, out_edge_iterator> vi =
        out_edges(b, g);
      BitOps::Bits *aout = b->getRow(AntOut);

      if (vi.first != vi.second) {
        ControlBlock *s = target(*vi.first, g);
        if (++vi.first != vi.second) {
          if (!changed) BitOps::bit_copy(width, tmp1, aout);
          BitOps::bit_and(width, aout,
                          s->getRow(AntIn),
                          target(*vi.first, g)->getRow(AntIn));
          while (++vi.first != vi.second) {
            s = target(*vi.first, g);
            BitOps::bit_and(width, aout, aout, s->getRow(AntIn));
          }
          if (!changed) changed = !BitOps::bit_equal(width, tmp1, aout);
        } else {
          if (!changed) {
            changed = !BitOps::bit_equal(width, aout, s->getRow(AntIn));
          }
          BitOps::bit_copy(width, aout, s->getRow(AntIn));
        }
      } else if (firstTime) {
        // anticipated defaults to all 1s
        // if there are no succs, set to all 0s
        BitOps::set(width, aout, 0);
      }

      BitOps::Bits *ain = b->getRow(AntIn);
      if (!changed) BitOps::bit_copy(width, tmp1, ain);
      BitOps::Bits *ant = b->getRow(Anticipated);
      if (hasAltered) {
        BitOps::Bits *alt = b->getRow(Altered);
        BitOps::bit_andc_or(width, ain, aout, alt, ant);
      } else {
        BitOps::bit_or(width, ain, aout, ant);
      }
      if (!changed) changed = !BitOps::bit_equal(width, tmp1, ain);
    }
  } while (changed);
}
开发者ID:rherbrich,项目名称:hiphop-php,代码行数:54,代码来源:data_flow.cpp

示例5: ComputeUsed

void DataFlow::ComputeUsed(const ControlFlowGraph &g) {
  int num = g.getNumBlocks();
  size_t width = g.bitWidth();

  for (int i = num; i ; i--) {
    ControlBlock *b = g.getDfBlock(i);
    BitOps::Bits *ant = b->getRow(Anticipated);
    BitOps::Bits *alt = b->getRow(Altered);
    BitOps::Bits *avl = b->getRow(Available);
    BitOps::bit_or_or(width, b->getRow(Used), ant, alt, avl);
  }
}
开发者ID:DenisBazhan,项目名称:hiphop-php,代码行数:12,代码来源:data_flow.cpp

示例6: ComputeForwards

void DataFlow::ComputeForwards(T func, const ControlFlowGraph &g,
                               int lAttr, int altAttr,
                               int inAttr, int outAttr) {
  int num = g.getNumBlocks();
  bool changed;
  BitOps::Bits *tmp1 = g.getTempBits(0);
  bool hasAltered = g.rowExists(altAttr);
  size_t width = g.bitWidth();

  do {
    changed = false;

    for (int i = 1; i <= num; i++) {
      ControlBlock *b = g.getDfBlock(i);
      std::pair<in_edge_iterator, in_edge_iterator> vi =
        boost::in_edges(b, g);
      BitOps::Bits *ain = b->getRow(inAttr);

      if (vi.first != vi.second) {
        ControlBlock *p = boost::source(*vi.first, g);
        if (++vi.first != vi.second) {
          if (!changed) BitOps::bit_copy(width, tmp1, ain);
          func(width, ain,
               p->getRow(outAttr),
               boost::source(*vi.first, g)->getRow(outAttr));
          while (++vi.first != vi.second) {
            p = boost::source(*vi.first, g);
            func(width, ain, ain, p->getRow(outAttr));
          }
          if (!changed) changed = !BitOps::bit_equal(width, tmp1, ain);
        } else {
          if (!changed) {
            changed = !BitOps::bit_equal(width, ain, p->getRow(outAttr));
          }
          BitOps::bit_copy(width, ain, p->getRow(outAttr));
        }
      }

      BitOps::Bits *aout = b->getRow(outAttr);
      if (!changed) BitOps::bit_copy(width, tmp1, aout);
      BitOps::Bits *avl = b->getRow(lAttr);
      if (hasAltered) {
        BitOps::Bits *alt = b->getRow(altAttr);
        BitOps::bit_andc_or(width, aout, ain, alt, avl);
      } else {
        BitOps::bit_or(width, aout, ain, avl);
      }
      if (!changed) changed = !BitOps::bit_equal(width, tmp1, aout);
    }
  } while (changed);
}
开发者ID:DenisBazhan,项目名称:hiphop-php,代码行数:51,代码来源:data_flow.cpp


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