Even in this form it is useful: it can detect branch instructions.
Details
Diff Detail
Event Timeline
I just added llvm-commits to the subscribers, otherwise the mailing list won't see the patch.
It looks like this ought to be testable from llvm-objdump (it seems to ise the MCInstrAnalysis to produce better output for branches).
No, not yet. It requires evaluateBranch to work. And that one doesn't work for AArch64 because offset arguments are not correctly annotated in assembly. (https://github.com/google/sanitizers/issues/706)
I was going to try to address the second issue in the next change. BTW if you have any pointers towards what needs to be changed, I would be grateful for any help/pointers.
And that one doesn't work for AArch64 because offset arguments are not correctly annotated in assembly. (https://github.com/google/sanitizers/issues/706).
Looking at the default implementation my best guess is that MI.getOperand(0).getImm() actually returns Offset / 4 for branches on AArch64 (because instructions must always be 4-byte aligned).
But I could be wrong, because I don't know exactly how it's failing.
Tim.
Depending on how you implement the AArch64 override you may want to set the branch operands to OPERAND_PCREL in the AArch64InstrInfo.td files to. Checking the opcodes directly is probably fine too though (you've got to know about them anyway to find the offset operand).
You are right, OperandType != MCOI::OPERAND_PCREL is never successful. Didn't look into getImm yet.
I managed to test this with my sancov tool. It can't print addresses yet, but at least it can initialize the instruction analysis.