Previous: Int Iterators, Up: Iterators


16.23.4 Subst Iterators

Subst iterators are special type of iterators with the following restrictions: they could not be declared explicitly, they always have only two values, and they do not have explicit dedicated name. Subst-iterators are triggered only when corresponding subst-attribute is used in RTL-pattern.

Subst iterators transform templates in the following way: the templates are duplicated, the subst-attributes in these templates are replaced with the corresponding values, and a new attribute is implicitly added to the given define_insn/define_expand. The name of the added attribute matches the name of define_subst. Such attributes are declared implicitly, and it is not allowed to have a define_attr named as a define_subst.

Each subst iterator is linked to a define_subst. It is declared implicitly by the first appearance of the corresponding define_subst_attr, and it is not allowed to define it explicitly.

Declarations of subst-attributes have the following syntax:

     (define_subst_attr "name"
       "subst-name"
       "no-subst-value"
       "subst-applied-value")

name is a string with which the given subst-attribute could be referred to.

subst-name shows which define_subst should be applied to an RTL-template if the given subst-attribute is present in the RTL-template.

no-subst-value is a value with which subst-attribute would be replaced in the first copy of the original RTL-template.

subst-applied-value is a value with which subst-attribute would be replaced in the second copy of the original RTL-template.