[LLVMdev] RFC: SDNode Flags

Dan Gohman gohman at apple.com
Sat Aug 1 13:12:39 PDT 2009


On Jul 31, 2009, at 11:26 AM, David Greene wrote:

> Right now the MemSDNode keeps a volatile bit in the SubclassData to  
> mark
> volatile memory operations.
>
> We have some changes we'd like to push back that adds a NonTemporal  
> flag
> to MemSDNode to mark instructions where movnt (on x86) and other  
> goodness
> can happen (we'll also add the TableGen patterns to properly select  
> movnt).
>
> In our tree we simply added another flag to the MemSDNode constructor
> and embedded it in SubclassData:
>
> MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, MVT MemoryVT,
>            const Value *srcValue, int SVOff,
>            unsigned alignment, bool isvolatile, bool NonTemporal);
>
> This is ugly for a variety of reasons and also doesn't scale as we
> want to add more of this kind of information.
>
> So what if we replace Volatile/NonTemporal with a single bitvector?
> There's not a lot of room in SubclassData (it also holds alignment
> information) so maybe this should be another member on MemSDNode.
> That will increase the size of MemSDNode, so we need to consider
> that.

LoadSDNode, which inherits from MemSDNode is the largest
SDNode.  With the current SDNode allocation strategy, making it
bigger will increase the allocation needed for all nodes.

>
> The constructor could look something like this:
>
> MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, MVT MemoryVT,
>            const Value *srcValue, int SVOff,
>            unsigned alignment, unsigned flags);
>
> and called like this:
>
> new (N) LoadSDNode(..., isVolatile|isNonTemporal);
>
> Thoughts?

This sounds reasonable.  I'd suggest using names like MemRefFlags rather
than isVolatileisNonTemporal, but that's just a detail :-).

My biggest concern is how this is encoded in the SDNode.  It'd be
good to avoid making MemSDNode bigger, but there are a variety of ways
that exiting bits can be made available.  NodeType doesn't need all 16  
of
its bits, for example, and OperandsNeedDelete could be merged with
OperandList with a PointerIntPair if needed.

How are you representing movnt in LLVM IR, with an intrinsic?

Dan




More information about the llvm-dev mailing list