This describes assembler instruction output.
asmoption in declarations to refer to registers using alternate names.
The definition is a C statement or statements which output an
assembler instruction opcode to the stdio stream stream. The
macro-operand ptr is a variable of type
char * which
points to the opcode name in its "internal" form--the form that is
written in the machine description. The definition should output the
opcode name to stream, performing any translation you desire, and
increment the variable ptr to point at the end of the opcode
so that it will not be output twice.
In fact, your macro definition may process less than the entire opcode
name, or more than the opcode name; but if you want to process text
%-sequences to substitute operands, you must take
care of the substitution yourself. Just be sure to increment
ptr over whatever text should not be output normally.
If you need to look at the operand values, they can be found as the
If the macro definition does nothing, the instruction is output
in the usual way.
Here the argument opvec is the vector containing the operands extracted from insn, and noperands is the number of elements of the vector which contain meaningful data for this insn. The contents of this vector are what will be used to convert the insn template into assembler code, so you can change the assembler output by changing the contents of the vector.
This macro is useful when various assembler syntaxes share a single file of instruction patterns; by defining this macro differently, you can cause a large class of instructions to be output differently (such as with rearranged operands). Naturally, variations in assembler syntax affecting individual insn patterns ought to be handled by writing conditional output routines in those patterns.
If this macro is not defined, it is equivalent to a null statement.
FINAL_PRESCAN_INSNwill be called on each
CODE_LABEL. In that case, opvec will be a null pointer and noperands will be zero.
code is a value that can be used to specify one of several ways
of printing the operand. It is used when identical operands must be
printed differently depending on the context. code comes from
% specification that was used to request printing of the
operand. If the specification was just
code is 0; if the specification was
then code is the ASCII code for ltr.
If x is a register, this macro should print the register's name.
The names can be found in an array
reg_names whose type is
reg_names is initialized from
When the machine description has a specification
% followed by a punctuation character), this macro is called
with a null pointer for x and the punctuation character for
PRINT_OPERAND_PUNCT_VALID_Pis not defined, it means that no punctuation characters (except for the standard one,
%) are used in this way.
On some machines, the syntax for a symbolic address depends on the
section that the address refers to. On these machines, define the macro
ENCODE_SECTION_INFO to store the information into the
symbol_ref, and then check for it here. See Assembler Format.
dbr_sequence_lengthto determine the number of slots filled in a sequence (zero if not currently outputting a sequence), to decide how many no-ops to output, or whatever.
Don't define this macro if it has nothing to do, but it is helpful in reading assembly output if the extent of the delay sequence is made explicit (e.g. with white space).
Note that output routines for instructions with delay slots must be
prepared to deal with not being output as part of a sequence
(i.e. when the scheduling pass is not run, or when no slot fillers could be
found.) The variable
final_sequence is null when not
processing a sequence, otherwise it contains the
final.c). These are useful when a single
mdfile must support multiple assembler formats. In that case, the various
tm.hfiles can define these macros differently.
casestatements which will be parsed inside the
switchstatement of the
asm_fprintffunction. This allows targets to define extra printf formats which may useful when generating their assembler statements. Note that upper case letters are reserved for future generic extensions to asm_fprintf, and so are not available to target specific code. The output file is given by the parameter file. The varargs input pointer is argptr and the rest of the format string, starting the character after the one that is being switched upon, is pointed to by format.
If this macro is defined, you may use constructs of the form
in the output templates of patterns (see Output Template) or in the
first argument of
asm_fprintf. This construct outputs
option2, etc., if the value of
ASSEMBLER_DIALECT is zero, one, two, etc. Any special characters
within these strings retain their usual meaning. If there are fewer
alternatives within the braces than the value of
ASSEMBLER_DIALECT, the construct outputs nothing.
If you do not define this macro, the characters
} do not have any special meaning when used in templates or
Define the macros
IMMEDIATE_PREFIX if you can express
the variations in assembler language syntax with that mechanism. Define
ASSEMBLER_DIALECT and use the
if the syntax variant are larger and involve such things as different
opcodes or operand order.