================ @@ -110,6 +111,34 @@ void BoltAddressTranslation::write(const BinaryContext &BC, raw_ostream &OS) { outs() << "BOLT-INFO: Wrote " << Maps.size() << " BAT maps\n"; } +APInt BoltAddressTranslation::calculateBranchEntriesBitMask(MapTy &Map, + size_t EqualElems) { + APInt BitMask(alignTo(EqualElems, 8), 0); + size_t Index = 0; + for (std::pair<const uint32_t, uint32_t> &KeyVal : Map) { + if (Index == EqualElems) + break; + const uint32_t OutputOffset = KeyVal.second; + if (OutputOffset & BRANCHENTRY) + BitMask.setBit(Index); + ++Index; + } + return BitMask; +} + +size_t BoltAddressTranslation::getNumEqualOffsets(const MapTy &Map) const { + size_t EqualOffsets = 0; + for (const std::pair<const uint32_t, uint32_t> &KeyVal : Map) { + const uint32_t OutputOffset = KeyVal.first; + const uint32_t InputOffset = KeyVal.second >> 1; + if (OutputOffset == InputOffset) + ++EqualOffsets; + else + break; ---------------- aaupov wrote:
Yes, that's by design. The idea is that if OutputOffset==InputOffset, only emit one of them. It's expected that if offsets start to diverge at some point, they're not reconverging. https://github.com/llvm/llvm-project/pull/76905 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits