コード例 #1
0
/// Set successor probability of a given iterator.
void MachineBasicBlock::setSuccProbability(succ_iterator I,
                                           BranchProbability Prob) {
  assert(!Prob.isUnknown());
  if (Probs.empty() || Weights.empty())
    return;
  *getProbabilityIterator(I) = Prob;
  // FIXME: Temporarily use the numerator of the probability to represent edge
  // weight. This will be removed once all weight-version interfaces in MBB
  // are replaces with probability-version interfaces.
  *getWeightIterator(I) = Prob.getNumerator();
}
コード例 #2
0
void MachineBasicBlock::addSuccessor(MachineBasicBlock *Succ,
                                     BranchProbability Prob) {
  // Probability list is either empty (if successor list isn't empty, this means
  // disabled optimization) or has the same size as successor list.
  if (!(Probs.empty() && !Successors.empty())) {
    Probs.push_back(Prob);
    // FIXME: Temporarily use the numerator of the probability to represent edge
    // weight. This will be removed once all weight-version interfaces in MBB
    // are replaced with probability-version interfaces.
    Weights.push_back(Prob.getNumerator());
  }
  Successors.push_back(Succ);
  Succ->addPredecessor(this);
}
コード例 #3
0
void PrintTo(BranchProbability P, ::std::ostream *os) {
  *os << P.getNumerator() << "/" << P.getDenominator();
}