[LLVMdev] deleting or replacing a MachineInst

Owen Anderson resistor at mac.com
Thu Feb 12 14:35:02 PST 2015


> On Feb 12, 2015, at 1:28 PM, Chris Sears <chris.sears at gmail.com> wrote:
> 
> 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.

Just FYI, this isn’t anything specific to MBBs or any other LLVM construct.  This problem, and the patterns for handling it, are common to all iterator access to C++ containers, including the STL ones.

—Owen





More information about the llvm-dev mailing list