Question about Hexagon VLIWResourceModel::reserveResources

Hi All,

  I am reading Hexagon's VLIW scheduler source code, and have a
question about VLIWResourceModel::reserveResources.

From what I understand, it checks if a SU can be put in current

Packet. Intuitively, if current Packet is full, isResourceAvailable
should return false immediately. However, I see the code below:

I'd have to look at the code in more detail, but the packet checks are only approximate. There are several instructions that are not checked against resource availability, so adding them may indeed exceed the packet size limit.
The precise checks are a lot more complex. One thing to keep track of are "constant extenders", which are special instructions that only hold immediate values for operands that wouldn't otherwise fit in the encoding of the instruction that uses them.