Next: , Previous: Comparing potentially-unordered poly_ints, Up: Comparisons involving poly_int   [Contents][Index]


10.3.4 Comparing ordered poly_ints

In cases where there is a definite link between two poly_ints, such as the outer and inner sizes of subregs, we usually require the sizes to be ordered by the known_le partial order. poly_int provides the following utility functions for ordered values:

ordered_p (a, b)

Return true if a and b are ordered by the known_le partial order.

ordered_min (a, b)

Assert that a and b are ordered by known_le and return the minimum of the two. When using this function, please add a comment explaining why the values are known to be ordered.

ordered_max (a, b)

Assert that a and b are ordered by known_le and return the maximum of the two. When using this function, please add a comment explaining why the values are known to be ordered.

For example, if a subreg has an outer mode of size outer and an inner mode of size inner:

Thus the subreg is only valid if ‘ordered_p (outer, inner)’ is true. If this condition is already known to be true then:

with the three conditions being mutually exclusive.

Code that checks whether a subreg is valid would therefore generally check whether ordered_p holds (in addition to whatever other checks are required for subreg validity). Code that is dealing with existing subregs can assert that ordered_p holds and use either of the classifications above.


Next: , Previous: Comparing potentially-unordered poly_ints, Up: Comparisons involving poly_int   [Contents][Index]