The following is for handling the compact syntax for constraints and
attributes.
The normal syntax looks like this:
...
(match_operand: 0 "s_register_operand" "r,I,k")
(match_operand: 2 "s_register_operand" "r,k,I")
...
"@
<asm>
<asm>
<asm>"
...
(set_attr "length" "4,8,8")
The compact syntax looks like this:
...
(match_operand: 0 "s_register_operand")
(match_operand: 2 "s_register_operand")
...
{@ [cons: 0, 2; attrs: length]
[r,r; 4] <asm>
[I,k; 8] <asm>
[k,I; 8] <asm>
}
...
[<other attributes>]
This is the only place where this syntax needs to be handled. Relevant
patterns are transformed from compact to the normal syntax before they are
queued, so none of the gen* programs need to know about this syntax at all.
Conversion process (convert_syntax):
0) Check that pattern actually uses new syntax (check for {@ ... }).
1) Get the "layout", i.e. the "[cons: 0 2; attrs: length]" from the above
example. cons must come first; both are optional. Set up two vecs,
convec and attrvec, for holding the results of the transformation.
2) For each alternative: parse the list of constraints and/or attributes,
and enqueue them in the relevant lists in convec and attrvec. By the end
of this process, convec[N].con and attrvec[N].con should contain regular
syntax constraint/attribute lists like "r,I,k". Copy the asm to a string
as we go.
3) Search the rtx and write the constraint and attribute lists into the
correct places. Write the asm back into the template.
Helper class for shuffling constraints/attributes in convert_syntax and
add_constraints/add_attributes. This includes commas but not whitespace.