[llvm-commits] [llvm] r96214 - /llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h

Dan Gohman gohman at apple.com
Wed Feb 17 09:06:22 PST 2010


On Feb 15, 2010, at 11:13 AM, Chris Lattner wrote:

> 
> On Feb 15, 2010, at 9:21 AM, Dan Gohman wrote:
> 
>> 
>> On Feb 14, 2010, at 11:11 PM, Chris Lattner wrote:
>> 
>>> Author: lattner
>>> Date: Mon Feb 15 01:11:34 2010
>>> New Revision: 96214
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=96214&view=rev
>>> Log:
>>> give SDValue an operator->, allowing V->isTargetOpcode() and
>>> many other natural things.
>> 
>> 
>> I had been gradually moving everything away from using SDValues
>> as if they were SDNodes. While it's convenient to ignore the
>> distinction sometimes, it's really hard to follow when it does
>> matter.
> 
> I'm ok with it if that is the direction you want to go, but it seems much more natural to treat SDValue as a "rich pointer".  It seems much more natural to use V->getOpcode() than V.getOpcode() or V.getOperand() etc.  The duplicated methods don't make a lot of sense to me (and yes, I'm to blame for the original poor design).

Basically, I think "rich pointer" is the wrong concept for SDValue.
It's really a (Node, ResNo) pair, and thinking about it as a pointer
means it's carrying around extra bits which sometimes matter and
sometimes don't.

I'd eventually like to get rid of both V.getOpcode() and V->getOpcode()
and replace them with V.getNode()->getOpcode(), for code that really
needs to do that kind of thing.

Dan





More information about the llvm-commits mailing list