Next: , Previous: , Up: Machine Desc   [Contents][Index]

17.21 RTL Templates Transformations

For some hardware architectures there are common cases when the RTL templates for the instructions can be derived from the other RTL templates using simple transformations. E.g., contains an RTL template for the ordinary sub instruction— *subsi_1, and for the sub instruction with subsequent zero-extension—*subsi_1_zext. Such cases can be easily implemented by a single meta-template capable of generating a modified case based on the initial one:

(define_subst "name"

input-template is a pattern describing the source RTL template, which will be transformed.

condition is a C expression that is conjunct with the condition from the input-template to generate a condition to be used in the output-template.

output-template is a pattern that will be used in the resulting template.

define_subst mechanism is tightly coupled with the notion of the subst attribute (see Subst Iterators). The use of define_subst is triggered by a reference to a subst attribute in the transforming RTL template. This reference initiates duplication of the source RTL template and substitution of the attributes with their values. The source RTL template is left unchanged, while the copy is transformed by define_subst. This transformation can fail in the case when the source RTL template is not matched against the input-template of the define_subst. In such case the copy is deleted.

define_subst can be used only in define_insn and define_expand, it cannot be used in other expressions (e.g. in define_insn_and_split).

Next: , Previous: , Up: Machine Desc   [Contents][Index]