From 13b72c22f731e9be33af0331f244f3407dca12f8 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Thu, 10 Oct 2013 12:02:16 +0000 Subject: [PATCH] md.texi: Document the mnemonic attribute. 2013-10-10 Andreas Krebbel * doc/md.texi: Document the mnemonic attribute. From-SVN: r203354 --- gcc/ChangeLog | 4 +++ gcc/doc/md.texi | 67 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fdf0f2cc1d3..87ba2a2314f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-10-10 Andreas Krebbel + + * doc/md.texi: Document the mnemonic attribute. + 2013-10-10 Andreas Krebbel PR target/57377 diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index c07663b9bc2..2a5a2e12dda 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -7698,6 +7698,7 @@ to track the condition codes. * Attr Example:: An example of assigning attributes. * Insn Lengths:: Computing the length of insns. * Constant Attributes:: Defining attributes that are constant. +* Mnemonic Attribute:: Obtain the instruction mnemonic as attribute value. * Delay Slots:: Defining delay slots required for a machine. * Processor pipeline description:: Specifying information for insn scheduling. @end menu @@ -7717,15 +7718,17 @@ by the target machine. It looks like: (define_attr @var{name} @var{list-of-values} @var{default}) @end smallexample -@var{name} is a string specifying the name of the attribute being defined. -Some attributes are used in a special way by the rest of the compiler. The -@code{enabled} attribute can be used to conditionally enable or disable -insn alternatives (@pxref{Disable Insn Alternatives}). The @code{predicable} -attribute, together with a suitable @code{define_cond_exec} -(@pxref{Conditional Execution}), can be used to automatically generate -conditional variants of instruction patterns. The compiler internally uses -the names @code{ce_enabled} and @code{nonce_enabled}, so they should not be -used elsewhere as alternative names. +@var{name} is a string specifying the name of the attribute being +defined. Some attributes are used in a special way by the rest of the +compiler. The @code{enabled} attribute can be used to conditionally +enable or disable insn alternatives (@pxref{Disable Insn +Alternatives}). The @code{predicable} attribute, together with a +suitable @code{define_cond_exec} (@pxref{Conditional Execution}), can +be used to automatically generate conditional variants of instruction +patterns. The @code{mnemonic} attribute can be used to check for the +instruction mnemonic (@pxref{Mnemonic Attribute}). The compiler +internally uses the names @code{ce_enabled} and @code{nonce_enabled}, +so they should not be used elsewhere as alternative names. @var{list-of-values} is either a string that specifies a comma-separated list of values that can be assigned to the attribute, or a null string to @@ -7789,6 +7792,11 @@ distances. @xref{Insn Lengths}. The @code{enabled} attribute can be defined to prevent certain alternatives of an insn definition from being used during code generation. @xref{Disable Insn Alternatives}. + +@item mnemonic +The @code{mnemonic} attribute can be defined to implement instruction +specific checks in e.g. the pipeline description. +@xref{Mnemonic Attribute}. @end table For each of these special attributes, the corresponding @@ -8339,6 +8347,47 @@ the value of a constant attribute may use the @code{symbol_ref} form, but may not use either the @code{match_operand} form or @code{eq_attr} forms involving insn attributes. +@end ifset +@ifset INTERNALS +@node Mnemonic Attribute +@subsection Mnemonic Attribute +@cindex mnemonic attribute + +The @code{mnemonic} attribute is a string type attribute holding the +instruction mnemonic for an insn alternative. The attribute values +will automatically be generated by the machine description parser if +there is an attribute definition in the md file: + +@smallexample +(define_attr "mnemonic" "unknown" (const_string "unknown")) +@end smallexample + +The default value can be freely chosen as long as it does not collide +with any of the instruction mnemonics. This value will be used +whenever the machine description parser is not able to determine the +mnemonic string. This might be the case for output templates +containing more than a single instruction as in +@code{"mvcle\t%0,%1,0\;jo\t.-4"}. + +The @code{mnemonic} attribute set is not generated automatically if the +instruction string is generated via C code. + +An existing @code{mnemonic} attribute set in an insn definition will not +be overriden by the md file parser. That way it is possible to +manually set the instruction mnemonics for the cases where the md file +parser fails to determine it automatically. + +The @code{mnemonic} attribute is useful for dealing with instruction +specific properties in the pipeline description without defining +additional insn attributes. + +@smallexample +(define_attr "ooo_expanded" "" + (cond [(eq_attr "mnemonic" "dlr,dsgr,d,dsgf,stam,dsgfr,dlgr") + (const_int 1)] + (const_int 0))) +@end smallexample + @end ifset @ifset INTERNALS @node Delay Slots