DFAPacketizer has a virtual method isLegalToPruneDependencies(). I looked at the Hexagon code and but wasn’t unable to understand the details (unfortunately as of now, I’m not well versed in the Hexagon architecture). Would anyone be able to shed light on what is dependency pruning and how it should be used?
Any help is appreciated.
Two instructions can be packetized if
- "isLegalToPacketizeTogether" returns true, or
- "isLegalToPruneDependencies" returns true.
The reason why two instructions may not be "legal to packetize together" may be that there is some form of dependency between the two. For example, one instruction may define register, and the next one may use it. In most cases on Hexagon, these cannot go into the same packet: all registers used in a packet are read before anything gets updated. There are exception to this, and in some cases, instructions can go together despite dependencies---this is where these dependencies can get "pruned" (which really means "ignored").
The code in Hexagon is somewhat convoluted, in the current shape it's not necessarily something to imitate. As a first approximation, you can just leave the "isLegalToPruneDependencies" with the default implementation (that returns "false"). This way only "isLegalToPacketizeTogether" will determine if two instructions can be in a packet together or not.
Thanks for the explanation.