[LLVMdev] RFC: SDNode Flags

Evan Cheng evan.cheng at apple.com
Sun Aug 2 18:57:54 PDT 2009


I also want a way to add target specific flag to a SDNode (which  
should be transferred to MachineInstr). For example, on x86 lots of  
opcodes have *lock* variants. Right now, these are separate  
instructions. I'd prefer to make it into a target specific flag that  
can be toggled by some sort of post-isel action routine.

One way to handle this might be to expand the use of SubclassData.  
There are 15 bits to play with and only the bottom 6-7 are in use (if  
I am reading it right). We can also reduce the width of following  
field NodeId (do we need 32-bit for it?) and widen SubclassData.

Also, NumOperands and NumValues can be changed to take up fewer bits.  
I don't think we need 16-bits for each.

So NodeType, OperandsNeedDelete, SubclassData, NodeId, NumOperands,  
and NumValues together are using 96 bits (assuming int is 32-bit and  
short is 16-bit). I think there is opportunity here to re-pack them  
and find quite a few bits for target specific data.

Evan

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.
>
> 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?
>
>                                    -Dave
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list