[LLVMdev] deleting or replacing a MachineInst

Chris Sears chris.sears at gmail.com
Thu Feb 12 13:28:23 PST 2015


Perhaps a better more neutral term is leaky abstraction.

The MBB iterator provides a documented abstraction. Look it up. Use it.
Done. Do not worry about how it works. Then along comes a problem which
isn't within that abstraction's abilities. So people come up with a
solution/workaround/xxxx which then becomes an accepted pattern and they
use that. This works.

The trouble is when other people who just read the documentation expect an
abstraction and its methods to just work. And they can't figure out why. We
don't really want to understand the implementation and search for patterns,
albeit widespread. It should be in the abstraction. It should be in the
documentation.

Now of course, I'm going to use this approach because it is faster than
restarting the loop. However, if it's so widespread and it does indeed
work, why not add it to the abstraction? Existing code will continue to
work but then this will be easier the next time for newbies to figure out
in the future.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150212/518a4880/attachment.html>


More information about the llvm-dev mailing list