gcc源代码分析,output_asm_insn()函数

来源:互联网 发布:福清广电网络微信缴费 编辑:程序博客网 时间:2024/06/10 08:34

insn call_insn 140
i=0 reg
i=1 mem
i=2 const_int
output_asm_insn call %1


/* Output of assembler code from a template, and its subroutines.  */

/* Output text from TEMPLATE to the assembler output file,
   obeying %-directions to substitute operands taken from
   the vector OPERANDS.

   %N (for N a digit) means print operand N in usual manner.
   %lN means require operand N to be a CODE_LABEL or LABEL_REF
      and print the label name with no punctuation.
   %cN means require operand N to be a constant
      and print the constant expression with no punctuation.
   %aN means expect operand N to be a memory address
      (not a memory reference!) and print a reference
      to that address.
   %nN means expect operand N to be a constant
      and print a constant expression for minus the value
      of the operand, with no other punctuation.  */

void
output_asm_insn (template, operands)
     char *template;
     rtx *operands;
{



      else if ((*p >= 'a' && *p <= 'z')
           || (*p >= 'A' && *p <= 'Z'))
        {
          int letter = *p++;
          c = atoi (p);

            ...

          else if (letter == 'l')
        output_asm_label (operands[c]);




Tm-i386.h (config):1058
#define PRINT_OPERAND(FILE, X, CODE)  \
  print_operand (FILE, X, CODE)


print_operand()函数在out-i386.c文件中




/* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol.  */

void
output_asm_label (x)
     rtx x;
{
  char buf[256];

  if (GET_CODE (x) == LABEL_REF)
    ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
  else if (GET_CODE (x) == CODE_LABEL)
    ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
  else
    output_operand_lossage ("`%l' operand isn't a label");

  assemble_name (asm_out_file, buf);
}

0 0
原创粉丝点击