Next:Constant Definitions, Previous:Conditional Execution, Up:Machine Descriptions [Contents][Index]
For some hardware architectures there are common cases when the RTLtemplates for the instructions can be derived from the other RTLtemplates using simple transformations. E.g.,i386.md containsan RTL template for the ordinarysub instruction—*subsi_1, and for thesub instruction with subsequentzero-extension—*subsi_1_zext. Such cases can be easilyimplemented by a single meta-template capable of generating a modifiedcase based on the initial one:
(define_subst "name" [input-template] "condition" [output-template])
input-template is a pattern describing the source RTL template,which will be transformed.
condition is a C expression that is conjunct with the conditionfrom the input-template to generate a condition to be used in theoutput-template.
output-template is a pattern that will be used in the resultingtemplate.
define_subst mechanism is tightly coupled with the notion of thesubst attribute (seeSubst Iterators). The use ofdefine_subst is triggered by a reference to a subst attribute inthe transforming RTL template. This reference initiates duplication ofthe source RTL template and substitution of the attributes with theirvalues. The source RTL template is left unchanged, while the copy istransformed bydefine_subst. This transformation can fail in thecase when the source RTL template is not matched against theinput-template of thedefine_subst. In such case the copy isdeleted.
define_subst can be used only indefine_insn anddefine_expand, it cannot be used in other expressions (e.g. indefine_insn_and_split).
Next:Constant Definitions, Previous:Conditional Execution, Up:Machine Descriptions [Contents][Index]