NFC: no-one uses getMemOpBaseRegImmOfs yet.
Add new hook TargetInstrInfo::getMemOpBaseRegImmOfs and implement for
x86. The implementation only handles a few easy cases now and will be
made more sophisticated in the future.
getMemOpBaseRegImmOfs, like getLdStBaseRegImmOfs, parses a memory
accessing instruction and tries to recover the memory being accessed as
a base pointer with a constant offset.
getMemOpBaseRegImmOfs is different from getLdStBaseRegImmOfs in the
sense that it also parses instructions that are not just loads and
stores, like "addl %ecx, (%rdi)" on x86.
Seems to me this should just reuse getLdStBaseRegImmOfs. Judging by the user of that callback, the MachineScheduler, whether a load/store was folded or standalone isn't interesting.
Though if you override that for X86, it means the scheduler behavior might change, which is a whole 'nother can of worms.
Andy knows best; +Matthias, who I believe has been looking into the scheduler.