📄 h8300.c
字号:
case CONST: case LABEL_REF: case SYMBOL_REF: return 3; case CONST_DOUBLE: return 20; default: return 4; }}/* Documentation for the machine specific operand escapes: 'A' print rn in h8/300 mode, erN in H8/300H mode 'C' print (operand - 2). 'E' like s but negative. 'F' like t but negative. 'G' constant just the negative 'M' turn a 'M' constant into its negative mod 2. 'P' if operand is incing/decing sp, print .w, otherwise .b. 'R' print operand as a byte:8 address if appropriate, else fall back to 'X' handling. 'S' print operand as a long word 'T' print operand as a word 'U' if operand is incing/decing sp, print l, otherwise nothing. 'V' find the set bit, and print its number. 'W' find the clear bit, and print its number. 'X' print operand as a byte 'Y' print either l or h depending on whether last 'Z' operand < 8 or >= 8. If this operand isn't a register, fall back to 'R' handling. 'Z' print int & 7. 'b' print the bit opcode 'c' print the ibit opcode 'd' bcc if EQ, bcs if NE 'e' first word of 32 bit value - if reg, then least reg. if mem then least. if const then most sig word 'f' second word of 32 bit value - if reg, then biggest reg. if mem then +2. if const then least sig word 'g' bcs if EQ, bcc if NE 'j' print operand as condition code. 'k' print operand as reverse condition code. 's' print as low byte of 16 bit value 't' print as high byte of 16 bit value 'w' print as low byte of 32 bit value 'x' print as 2nd byte of 32 bit value 'y' print as 3rd byte of 32 bit value 'z' print as msb of 32 bit value*//* Return assembly language string which identifies a comparison type. */static char *cond_string (code) enum rtx_code code;{ switch (code) { case NE: return "ne"; case EQ: return "eq"; case GE: return "ge"; case GT: return "gt"; case LE: return "le"; case LT: return "lt"; case GEU: return "hs"; case GTU: return "hi"; case LEU: return "ls"; case LTU: return "lo"; default: abort (); }}/* Print operand X using operand code CODE to assembly language output file FILE. */voidprint_operand (file, x, code) FILE *file; rtx x; int code;{ /* This is used for communication between the 'P' and 'U' codes. */ static char *last_p; /* This is used for communication between codes V,W,Z and Y. */ static int bitint; switch (code) { case 'A': if (GET_CODE (x) == REG) fprintf (file, "%s", h8_reg_names[REGNO (x)]); else goto def; break; case 'C': fprintf (file, "#%d", INTVAL (x) - 2); break; case 'E': switch (GET_CODE (x)) { case REG: fprintf (file, "%sl", names_big[REGNO (x)]); break; case CONST_INT: fprintf (file, "#%d", (-INTVAL (x)) & 0xff); break; default: abort (); } break; case 'F': switch (GET_CODE (x)) { case REG: fprintf (file, "%sh", names_big[REGNO (x)]); break; case CONST_INT: fprintf (file, "#%d", ((-INTVAL (x)) & 0xff00) >> 8); break; default: abort (); } break; case 'G': if (GET_CODE (x) != CONST_INT) abort (); fprintf (file, "#%d", 0xff & (-INTVAL (x))); break; case 'M': /* For 3/-3 and 4/-4, the other 2 is handled separately. */ switch (INTVAL (x)) { case 2: case 4: case -2: case -4: fprintf (file, "#2"); break; case 1: case 3: case -1: case -3: fprintf (file, "#1"); break; default: abort (); } break; case 'P': if (REGNO (XEXP (XEXP (x, 0), 0)) == STACK_POINTER_REGNUM) { last_p = ""; fprintf (file, ".w"); } else { last_p = "l"; fprintf (file, ".b"); } break; case 'S': if (GET_CODE (x) == REG) fprintf (file, "%s", names_extended[REGNO (x)]); else goto def; break; case 'T': if (GET_CODE (x) == REG) fprintf (file, "%s", names_big[REGNO (x)]); else goto def; break; case 'U': fprintf (file, "%s%s", names_big[REGNO (x)], last_p); break; case 'V': bitint = exact_log2 (INTVAL (x)); if (bitint == -1) abort (); fprintf (file, "#%d", bitint & 7); break; case 'W': bitint = exact_log2 ((~INTVAL (x)) & 0xff); if (bitint == -1) abort (); fprintf (file, "#%d", bitint & 7); break; case 'R': case 'X': if (GET_CODE (x) == REG) fprintf (file, "%s", byte_reg (x, 0)); else goto def; break; case 'Y': if (bitint == -1) abort (); if (GET_CODE (x) == REG) fprintf (file, "%s%c", names_big[REGNO (x)], bitint > 7 ? 'h' : 'l'); else print_operand (file, x, 'R'); bitint = -1; break; case 'Z': bitint = INTVAL (x); fprintf (file, "#%d", bitint & 7); break; case 'b': switch (GET_CODE (x)) { case IOR: fprintf (file, "bor"); break; case XOR: fprintf (file, "bxor"); break; case AND: fprintf (file, "band"); break; } break; case 'c': switch (GET_CODE (x)) { case IOR: fprintf (file, "bior"); break; case XOR: fprintf (file, "bixor"); break; case AND: fprintf (file, "biand"); break; } break; case 'd': switch (GET_CODE (x)) { case EQ: fprintf (file, "bcc"); break; case NE: fprintf (file, "bcs"); break; default: abort (); } break; case 'e': switch (GET_CODE (x)) { case REG: if (TARGET_H8300) fprintf (file, "%s", names_big[REGNO (x)]); else fprintf (file, "%s", names_upper_extended[REGNO (x)]); break; case MEM: x = adj_offsettable_operand (x, 0); print_operand (file, x, 0); break; case CONST_INT: fprintf (file, "#%d", ((INTVAL (x) >> 16) & 0xffff)); break; case CONST_DOUBLE: { long val; REAL_VALUE_TYPE rv; REAL_VALUE_FROM_CONST_DOUBLE (rv, x); REAL_VALUE_TO_TARGET_SINGLE (rv, val); fprintf (file, "#%d", ((val >> 16) & 0xffff)); break; } default: abort (); break; } break; case 'f': switch (GET_CODE (x)) { case REG: if (TARGET_H8300) fprintf (file, "%s", names_big[REGNO (x) + 1]); else fprintf (file, "%s", names_big[REGNO (x)]); break; case MEM: x = adj_offsettable_operand (x, 2); print_operand (file, x, 0); break; case CONST_INT: fprintf (file, "#%d", INTVAL (x) & 0xffff); break; case CONST_DOUBLE: { long val; REAL_VALUE_TYPE rv; REAL_VALUE_FROM_CONST_DOUBLE (rv, x); REAL_VALUE_TO_TARGET_SINGLE (rv, val); fprintf (file, "#%d", (val & 0xffff)); break; } default: abort (); } break; case 'g': switch (GET_CODE (x)) { case NE: fprintf (file, "bcc"); break; case EQ: fprintf (file, "bcs"); break; default: abort (); } break; case 'j': asm_fprintf (file, cond_string (GET_CODE (x))); break; case 'k': asm_fprintf (file, cond_string (reverse_condition (GET_CODE (x)))); break; case 's': if (GET_CODE (x) == CONST_INT) fprintf (file, "#%d", (INTVAL (x)) & 0xff); else fprintf (file, "%s", byte_reg (x, 0)); break; case 't': if (GET_CODE (x) == CONST_INT) fprintf (file, "#%d", (INTVAL (x) >> 8) & 0xff); else fprintf (file, "%s", byte_reg (x, 1)); break; case 'u': if (GET_CODE (x) != CONST_INT) abort (); fprintf (file, "%d", INTVAL (x)); break; case 'w': if (GET_CODE (x) == CONST_INT) fprintf (file, "#%d", INTVAL (x) & 0xff); else fprintf (file, "%s", byte_reg (x, TARGET_H8300 ? 2 : 0)); break; case 'x': if (GET_CODE (x) == CONST_INT) fprintf (file, "#%d", (INTVAL (x) >> 8) & 0xff); else fprintf (file, "%s", byte_reg (x, TARGET_H8300 ? 3 : 1)); break; case 'y': if (GET_CODE (x) == CONST_INT) fprintf (file, "#%d", (INTVAL (x) >> 16) & 0xff); else fprintf (file, "%s", byte_reg (x, 0)); break; case 'z': if (GET_CODE (x) == CONST_INT) fprintf (file, "#%d", (INTVAL (x) >> 24) & 0xff); else fprintf (file, "%s", byte_reg (x, 1)); break; default: def: switch (GET_CODE (x)) { case REG: switch (GET_MODE (x)) { case QImode:#if 0 /* Is it asm ("mov.b %0,r2l", ...) */ fprintf (file, "%s", byte_reg (x, 0));#else /* ... or is it asm ("mov.b %0l,r2l", ...) */ fprintf (file, "%s", names_big[REGNO (x)]);#endif break; case HImode: fprintf (file, "%s", names_big[REGNO (x)]); break; case SImode: case SFmode: fprintf (file, "%s", names_extended[REGNO (x)]); break; default: abort (); } break; case MEM: fprintf (file, "@"); output_address (XEXP (x, 0)); /* If this is an 'R' operand (reference into the 8-bit area), then specify a symbolic address as "foo:8", otherwise if operand is still in eight bit section, use "foo:16". */ if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF && SYMBOL_REF_FLAG (XEXP (x, 0))) fprintf (file, (code == 'R' ? ":8" : ":16")); else if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF && TINY_DATA_NAME_P (XSTR (XEXP (x, 0), 0))) fprintf (file, ":16"); break; case CONST_INT: case SYMBOL_REF: case CONST: case LABEL_REF: fprintf (file, "#"); print_operand_address (file, x); break; case CONST_DOUBLE: { long val; REAL_VALUE_TYPE rv; REAL_VALUE_FROM_CONST_DOUBLE (rv, x); REAL_VALUE_TO_TARGET_SINGLE (rv, val); fprintf (file, "#%d", val); break; } } }}/* Output assembly language output for the address ADDR to FILE. */voidprint_operand_address (file, addr) FILE *file; rtx addr;{ switch (GET_CODE (addr)) { case REG: fprintf (file, "%s", h8_reg_names[REGNO (addr)]); break; case PRE_DEC: fprintf (file, "-%s", h8_reg_names[REGNO (XEXP (addr, 0))]); break; case POST_INC: fprintf (file, "%s+", h8_reg_names[REGNO (XEXP (addr, 0))]); break; case PLUS: fprintf (file, "("); if (GET_CODE (XEXP (addr, 0)) == REG) { /* reg,foo */ print_operand_address (file, XEXP (addr, 1)); fprintf (file, ","); print_operand_address (file, XEXP (addr, 0)); } else { /* foo+k */ print_operand_address (file, XEXP (addr, 0)); fprintf (file, "+"); print_operand_address (file, XEXP (addr, 1)); } fprintf (file, ")"); break; case CONST_INT: { /* Since the h8/300 only has 16 bit pointers, negative values are also those >= 32768. This happens for example with pointer minus a constant. We don't want to turn (char *p - 2) into (char *p + 65534) because loop unrolling can build upon this (IE: char *p + 131068). */ int n = INTVAL (addr); if (TARGET_H8300) n = (int) (short) n; if (n < 0) /* ??? Why the special case for -ve values? */ fprintf (file, "-%d", -n); else fprintf (file, "%d", n);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -