gccint: Instruction Output
1
1 18.20.7 Output of Assembler Instructions
1 ----------------------------------------
1
1 This describes assembler instruction output.
1
1 -- Macro: REGISTER_NAMES
1 A C initializer containing the assembler's names for the machine
1 registers, each one as a C string constant. This is what
1 translates register numbers in the compiler into assembler
1 language.
1
1 -- Macro: ADDITIONAL_REGISTER_NAMES
1 If defined, a C initializer for an array of structures containing a
1 name and a register number. This macro defines additional names
1 for hard registers, thus allowing the 'asm' option in declarations
1 to refer to registers using alternate names.
1
1 -- Macro: OVERLAPPING_REGISTER_NAMES
1 If defined, a C initializer for an array of structures containing a
1 name, a register number and a count of the number of consecutive
1 machine registers the name overlaps. This macro defines additional
1 names for hard registers, thus allowing the 'asm' option in
1 declarations to refer to registers using alternate names. Unlike
1 'ADDITIONAL_REGISTER_NAMES', this macro should be used when the
1 register name implies multiple underlying registers.
1
1 This macro should be used when it is important that a clobber in an
1 'asm' statement clobbers all the underlying values implied by the
1 register name. For example, on ARM, clobbering the
1 double-precision VFP register "d0" implies clobbering both
1 single-precision registers "s0" and "s1".
1
1 -- Macro: ASM_OUTPUT_OPCODE (STREAM, PTR)
1 Define this macro if you are using an unusual assembler that
1 requires different names for the machine instructions.
1
1 The definition is a C statement or statements which output an
1 assembler instruction opcode to the stdio stream STREAM. The
1 macro-operand PTR is a variable of type 'char *' which points to
1 the opcode name in its "internal" form--the form that is written in
1 the machine description. The definition should output the opcode
1 name to STREAM, performing any translation you desire, and
1 increment the variable PTR to point at the end of the opcode so
1 that it will not be output twice.
1
1 In fact, your macro definition may process less than the entire
1 opcode name, or more than the opcode name; but if you want to
1 process text that includes '%'-sequences to substitute operands,
1 you must take care of the substitution yourself. Just be sure to
1 increment PTR over whatever text should not be output normally.
1
1 If you need to look at the operand values, they can be found as the
1 elements of 'recog_data.operand'.
1
1 If the macro definition does nothing, the instruction is output in
1 the usual way.
1
1 -- Macro: FINAL_PRESCAN_INSN (INSN, OPVEC, NOPERANDS)
1 If defined, a C statement to be executed just prior to the output
1 of assembler code for INSN, to modify the extracted operands so
1 they will be output differently.
1
1 Here the argument OPVEC is the vector containing the operands
1 extracted from INSN, and NOPERANDS is the number of elements of the
1 vector which contain meaningful data for this insn. The contents
1 of this vector are what will be used to convert the insn template
1 into assembler code, so you can change the assembler output by
1 changing the contents of the vector.
1
1 This macro is useful when various assembler syntaxes share a single
1 file of instruction patterns; by defining this macro differently,
1 you can cause a large class of instructions to be output
1 differently (such as with rearranged operands). Naturally,
1 variations in assembler syntax affecting individual insn patterns
1 ought to be handled by writing conditional output routines in those
1 patterns.
1
1 If this macro is not defined, it is equivalent to a null statement.
1
1 -- Target Hook: void TARGET_ASM_FINAL_POSTSCAN_INSN (FILE *FILE,
1 rtx_insn *INSN, rtx *OPVEC, int NOPERANDS)
1 If defined, this target hook is a function which is executed just
1 after the output of assembler code for INSN, to change the mode of
1 the assembler if necessary.
1
1 Here the argument OPVEC is the vector containing the operands
1 extracted from INSN, and NOPERANDS is the number of elements of the
1 vector which contain meaningful data for this insn. The contents
1 of this vector are what was used to convert the insn template into
1 assembler code, so you can change the assembler mode by checking
1 the contents of the vector.
1
1 -- Macro: PRINT_OPERAND (STREAM, X, CODE)
1 A C compound statement to output to stdio stream STREAM the
1 assembler syntax for an instruction operand X. X is an RTL
1 expression.
1
1 CODE is a value that can be used to specify one of several ways of
1 printing the operand. It is used when identical operands must be
1 printed differently depending on the context. CODE comes from the
1 '%' specification that was used to request printing of the operand.
1 If the specification was just '%DIGIT' then CODE is 0; if the
1 specification was '%LTR DIGIT' then CODE is the ASCII code for LTR.
1
1 If X is a register, this macro should print the register's name.
1 The names can be found in an array 'reg_names' whose type is 'char
1 *[]'. 'reg_names' is initialized from 'REGISTER_NAMES'.
1
1 When the machine description has a specification '%PUNCT' (a '%'
1 followed by a punctuation character), this macro is called with a
1 null pointer for X and the punctuation character for CODE.
1
1 -- Macro: PRINT_OPERAND_PUNCT_VALID_P (CODE)
1 A C expression which evaluates to true if CODE is a valid
1 punctuation character for use in the 'PRINT_OPERAND' macro. If
1 'PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
1 punctuation characters (except for the standard one, '%') are used
1 in this way.
1
1 -- Macro: PRINT_OPERAND_ADDRESS (STREAM, X)
1 A C compound statement to output to stdio stream STREAM the
1 assembler syntax for an instruction operand that is a memory
1 reference whose address is X. X is an RTL expression.
1
1 On some machines, the syntax for a symbolic address depends on the
1 section that the address refers to. On these machines, define the
1 hook 'TARGET_ENCODE_SECTION_INFO' to store the information into the
11 'symbol_ref', and then check for it here. ⇒Assembler
Format.
1
1 -- Macro: DBR_OUTPUT_SEQEND (FILE)
1 A C statement, to be executed after all slot-filler instructions
1 have been output. If necessary, call 'dbr_sequence_length' to
1 determine the number of slots filled in a sequence (zero if not
1 currently outputting a sequence), to decide how many no-ops to
1 output, or whatever.
1
1 Don't define this macro if it has nothing to do, but it is helpful
1 in reading assembly output if the extent of the delay sequence is
1 made explicit (e.g. with white space).
1
1 Note that output routines for instructions with delay slots must be
1 prepared to deal with not being output as part of a sequence (i.e. when
1 the scheduling pass is not run, or when no slot fillers could be found.)
1 The variable 'final_sequence' is null when not processing a sequence,
1 otherwise it contains the 'sequence' rtx being output.
1
1 -- Macro: REGISTER_PREFIX
1 -- Macro: LOCAL_LABEL_PREFIX
1 -- Macro: USER_LABEL_PREFIX
1 -- Macro: IMMEDIATE_PREFIX
1 If defined, C string expressions to be used for the '%R', '%L',
1 '%U', and '%I' options of 'asm_fprintf' (see 'final.c'). These are
1 useful when a single 'md' file must support multiple assembler
1 formats. In that case, the various 'tm.h' files can define these
1 macros differently.
1
1 -- Macro: ASM_FPRINTF_EXTENSIONS (FILE, ARGPTR, FORMAT)
1 If defined this macro should expand to a series of 'case'
1 statements which will be parsed inside the 'switch' statement of
1 the 'asm_fprintf' function. This allows targets to define extra
1 printf formats which may useful when generating their assembler
1 statements. Note that uppercase letters are reserved for future
1 generic extensions to asm_fprintf, and so are not available to
1 target specific code. The output file is given by the parameter
1 FILE. The varargs input pointer is ARGPTR and the rest of the
1 format string, starting the character after the one that is being
1 switched upon, is pointed to by FORMAT.
1
1 -- Macro: ASSEMBLER_DIALECT
1 If your target supports multiple dialects of assembler language
1 (such as different opcodes), define this macro as a C expression
1 that gives the numeric index of the assembler language dialect to
1 use, with zero as the first variant.
1
1 If this macro is defined, you may use constructs of the form
1 '{option0|option1|option2...}'
1 in the output templates of patterns (⇒Output Template) or in
1 the first argument of 'asm_fprintf'. This construct outputs
1 'option0', 'option1', 'option2', etc., if the value of
1 'ASSEMBLER_DIALECT' is zero, one, two, etc. Any special characters
1 within these strings retain their usual meaning. If there are
1 fewer alternatives within the braces than the value of
1 'ASSEMBLER_DIALECT', the construct outputs nothing. If it's needed
1 to print curly braces or '|' character in assembler output
1 directly, '%{', '%}' and '%|' can be used.
1
1 If you do not define this macro, the characters '{', '|' and '}' do
1 not have any special meaning when used in templates or operands to
1 'asm_fprintf'.
1
1 Define the macros 'REGISTER_PREFIX', 'LOCAL_LABEL_PREFIX',
1 'USER_LABEL_PREFIX' and 'IMMEDIATE_PREFIX' if you can express the
1 variations in assembler language syntax with that mechanism.
1 Define 'ASSEMBLER_DIALECT' and use the '{option0|option1}' syntax
1 if the syntax variant are larger and involve such things as
1 different opcodes or operand order.
1
1 -- Macro: ASM_OUTPUT_REG_PUSH (STREAM, REGNO)
1 A C expression to output to STREAM some assembler code which will
1 push hard register number REGNO onto the stack. The code need not
1 be optimal, since this macro is used only when profiling.
1
1 -- Macro: ASM_OUTPUT_REG_POP (STREAM, REGNO)
1 A C expression to output to STREAM some assembler code which will
1 pop hard register number REGNO off of the stack. The code need not
1 be optimal, since this macro is used only when profiling.
1