================ @@ -1682,48 +1648,66 @@ void Analysis::runOnFunction(BinaryFunction &BF, } } +// Compute the instruction address for printing (may be slow). +static uint64_t getAddress(const MCInstReference &Inst) { + const BinaryFunction *BF = Inst.getFunction(); + + if (Inst.hasCFG()) { + const BinaryBasicBlock *BB = Inst.getBasicBlock(); + + auto It = static_cast<BinaryBasicBlock::const_iterator>(&Inst.getMCInst()); + unsigned IndexInBB = std::distance(BB->begin(), It); + + // FIXME: this assumes all instructions are 4 bytes in size. This is true ---------------- maksfb wrote:
We have `BinaryContext::computeCodeSize()`. https://github.com/llvm/llvm-project/pull/138655 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits