gccint: Define Subst

1 
1 17.21 RTL Templates Transformations
1 ===================================
1 
1 For some hardware architectures there are common cases when the RTL
1 templates for the instructions can be derived from the other RTL
1 templates using simple transformations.  E.g., 'i386.md' contains an RTL
1 template for the ordinary 'sub' instruction-- '*subsi_1', and for the
1 'sub' instruction with subsequent zero-extension--'*subsi_1_zext'.  Such
1 cases can be easily implemented by a single meta-template capable of
1 generating a modified case based on the initial one:
1 
1      (define_subst "NAME"
1        [INPUT-TEMPLATE]
1        "CONDITION"
1        [OUTPUT-TEMPLATE])
1  INPUT-TEMPLATE is a pattern describing the source RTL template, which
1 will be transformed.
1 
1  CONDITION is a C expression that is conjunct with the condition from
1 the input-template to generate a condition to be used in the
1 output-template.
1 
1  OUTPUT-TEMPLATE is a pattern that will be used in the resulting
1 template.
1 
1  'define_subst' mechanism is tightly coupled with the notion of the
1 subst attribute (⇒Subst Iterators).  The use of 'define_subst' is
1 triggered by a reference to a subst attribute in the transforming RTL
1 template.  This reference initiates duplication of the source RTL
1 template and substitution of the attributes with their values.  The
1 source RTL template is left unchanged, while the copy is transformed by
1 'define_subst'.  This transformation can fail in the case when the
1 source RTL template is not matched against the input-template of the
1 'define_subst'.  In such case the copy is deleted.
1 
1  'define_subst' can be used only in 'define_insn' and 'define_expand',
1 it cannot be used in other expressions (e.g.  in
1 'define_insn_and_split').
1 

Menu