Previous:Pattern Matching indefine_subst, Up:RTL Templates Transformations [Contents][Index]
define_subst ¶If all necessary checks fordefine_subst application pass, a newRTL-pattern, based on the output-template, is created to replace the oldtemplate. Like in input-patterns, meanings of some RTL expressions arechanged when they are used in output-patterns of adefine_subst.Thus,match_dup is used for copying the whole expression from theoriginal pattern, which matched correspondingmatch_operand fromthe input pattern.
match_dup N is used in the output template to be replaced withthe expression from the original pattern, which matchedmatch_operand N from the input pattern. As a consequence,match_dup cannot be used to point tomatch_operands fromthe output pattern, it should always refer to amatch_operandfrom the input pattern. If amatch_dup N occurs more than oncein the output template, its first occurrence is replaced with theexpression from the original pattern, and the subsequent expressionsare replaced withmatch_dup N, i.e., a reference to the firstexpression.
In the output template one can refer to the expressions from theoriginal pattern and create new ones. For instance, some operands couldbe added by means of standardmatch_operand.
After replacingmatch_dup with some RTL-subtree from the originalpattern, it could happen that severalmatch_operands in theoutput pattern have the same indexes. It is unknown, how many and whatindexes would be used in the expression which would replacematch_dup, so such conflicts in indexes are inevitable. Toovercome this issue,match_operands andmatch_operators,which were introduced into the output pattern, are renumerated when allmatch_dups are replaced.
Number of alternatives inmatch_operands introduced into theoutput templateM could differ from the number of alternatives inthe original patternN, so in the resultant pattern there wouldbeN*M alternatives. Thus, constraints from the original patternwould be duplicatedN times, constraints from the output patternwould be duplicatedM times, producing all possible combinations.
Previous:Pattern Matching indefine_subst, Up:RTL Templates Transformations [Contents][Index]