📄 alpha.c
字号:
/* Subroutines used for code generation on the DEC Alpha. Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA. */#include <stdio.h>#include "config.h"#include "rtl.h"#include "regs.h"#include "hard-reg-set.h"#include "real.h"#include "insn-config.h"#include "conditions.h"#include "insn-flags.h"#include "output.h"#include "insn-attr.h"#include "flags.h"#include "recog.h"#include "reload.h"#include "expr.h"#include "obstack.h"#include "tree.h"/* Save information from a "cmpxx" operation until the branch or scc is emitted. */rtx alpha_compare_op0, alpha_compare_op1;int alpha_compare_fp_p;/* Save the name of the current function as used by the assembler. This is used by the epilogue. */char *alpha_function_name;/* Non-zero if inside of a function, because the Alpha asm can't handle .files inside of functions. */static int inside_function = FALSE;/* Nonzero if the current function needs gp. */int alpha_function_needs_gp;extern char *version_string;extern int rtx_equal_function_value_matters;/* Declarations of static functions. */static void alpha_set_memflags_1 PROTO((rtx, int, int, int));static void add_long_const PROTO((FILE *, HOST_WIDE_INT, int, int, int));/* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */intzap_mask (value) HOST_WIDE_INT value;{ int i; for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++, value >>= 8) if ((value & 0xff) != 0 && (value & 0xff) != 0xff) return 0; return 1;}/* Returns 1 if OP is either the constant zero or a register. If a register, it must be in the proper mode unless MODE is VOIDmode. */intreg_or_0_operand (op, mode) register rtx op; enum machine_mode mode;{ return op == const0_rtx || register_operand (op, mode);}/* Return 1 if OP is a constant in the range of 0-63 (for a shift) or any register. */intreg_or_6bit_operand (op, mode) register rtx op; enum machine_mode mode;{ return ((GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 64) || register_operand (op, mode));}/* Return 1 if OP is an 8-bit constant or any register. */intreg_or_8bit_operand (op, mode) register rtx op; enum machine_mode mode;{ return ((GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100) || register_operand (op, mode));}/* Return 1 if OP is an 8-bit constant. */intcint8_operand (op, mode) register rtx op; enum machine_mode mode;{ return (GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100);}/* Return 1 if the operand is a valid second operand to an add insn. */intadd_operand (op, mode) register rtx op; enum machine_mode mode;{ if (GET_CODE (op) == CONST_INT) return (CONST_OK_FOR_LETTER_P (INTVAL (op), 'K') || CONST_OK_FOR_LETTER_P (INTVAL (op), 'L') || CONST_OK_FOR_LETTER_P (INTVAL (op), 'O')); return register_operand (op, mode);}/* Return 1 if the operand is a valid second operand to a sign-extending add insn. */intsext_add_operand (op, mode) register rtx op; enum machine_mode mode;{ if (GET_CODE (op) == CONST_INT) return ((unsigned HOST_WIDE_INT) INTVAL (op) < 255 || (unsigned HOST_WIDE_INT) (- INTVAL (op)) < 255); return register_operand (op, mode);}/* Return 1 if OP is the constant 4 or 8. */intconst48_operand (op, mode) register rtx op; enum machine_mode mode;{ return (GET_CODE (op) == CONST_INT && (INTVAL (op) == 4 || INTVAL (op) == 8));}/* Return 1 if OP is a valid first operand to an AND insn. */intand_operand (op, mode) register rtx op; enum machine_mode mode;{ if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode) return (zap_mask (CONST_DOUBLE_LOW (op)) && zap_mask (CONST_DOUBLE_HIGH (op))); if (GET_CODE (op) == CONST_INT) return ((unsigned HOST_WIDE_INT) INTVAL (op) < 0x100 || (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100 || zap_mask (INTVAL (op))); return register_operand (op, mode);}/* Return 1 if OP is a valid first operand to an IOR or XOR insn. */intor_operand (op, mode) register rtx op; enum machine_mode mode;{ if (GET_CODE (op) == CONST_INT) return ((unsigned HOST_WIDE_INT) INTVAL (op) < 0x100 || (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100); return register_operand (op, mode);}/* Return 1 if OP is a constant that is the width, in bits, of an integral mode smaller than DImode. */intmode_width_operand (op, mode) register rtx op; enum machine_mode mode;{ return (GET_CODE (op) == CONST_INT && (INTVAL (op) == 8 || INTVAL (op) == 16 || INTVAL (op) == 32));}/* Return 1 if OP is a constant that is the width of an integral machine mode smaller than an integer. */intmode_mask_operand (op, mode) register rtx op; enum machine_mode mode;{#if HOST_BITS_PER_WIDE_INT == 32 if (GET_CODE (op) == CONST_DOUBLE) return CONST_DOUBLE_HIGH (op) == 0 && CONST_DOUBLE_LOW (op) == -1;#endif return (GET_CODE (op) == CONST_INT && (INTVAL (op) == 0xff || INTVAL (op) == 0xffff#if HOST_BITS_PER_WIDE_INT == 64 || INTVAL (op) == 0xffffffff#endif ));}/* Return 1 if OP is a multiple of 8 less than 64. */intmul8_operand (op, mode) register rtx op; enum machine_mode mode;{ return (GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (op) < 64 && (INTVAL (op) & 7) == 0);}/* Return 1 if OP is the constant zero in floating-point. */intfp0_operand (op, mode) register rtx op; enum machine_mode mode;{ return (GET_MODE (op) == mode && GET_MODE_CLASS (mode) == MODE_FLOAT && op == CONST0_RTX (mode));}/* Return 1 if OP is the floating-point constant zero or a register. */intreg_or_fp0_operand (op, mode) register rtx op; enum machine_mode mode;{ return fp0_operand (op, mode) || register_operand (op, mode);}/* Return 1 if OP is a register or a constant integer. */intreg_or_cint_operand (op, mode) register rtx op; enum machine_mode mode;{ return GET_CODE (op) == CONST_INT || register_operand (op, mode);}/* Return 1 if OP is something that can be reloaded into a register; if it is a MEM, it need not be valid. */intsome_operand (op, mode) register rtx op; enum machine_mode mode;{ if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; switch (GET_CODE (op)) { case REG: case MEM: case CONST_DOUBLE: case CONST_INT: case LABEL_REF: case SYMBOL_REF: case CONST: return 1; case SUBREG: return some_operand (SUBREG_REG (op), VOIDmode); } return 0;}/* Return 1 if OP is a valid operand for the source of a move insn. */intinput_operand (op, mode) register rtx op; enum machine_mode mode;{ if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) return 0; if (GET_MODE_CLASS (mode) == MODE_FLOAT && GET_MODE (op) != mode) return 0; switch (GET_CODE (op)) { case LABEL_REF: case SYMBOL_REF: case CONST: /* This handles both the Windows/NT and OSF cases. */ return mode == ptr_mode || mode == DImode; case REG: return 1; case SUBREG: if (register_operand (op, mode)) return 1; /* ... fall through ... */ case MEM: return mode != HImode && mode != QImode && general_operand (op, mode); case CONST_DOUBLE: return GET_MODE_CLASS (mode) == MODE_FLOAT && op == CONST0_RTX (mode); case CONST_INT: return mode == QImode || mode == HImode || add_operand (op, mode); } return 0;}/* Return 1 if OP is a SYMBOL_REF for a function known to be in this file. */intcurrent_file_function_operand (op, mode) rtx op; enum machine_mode mode;{ return (GET_CODE (op) == SYMBOL_REF && ! profile_flag && ! profile_block_flag && (SYMBOL_REF_FLAG (op) || op == XEXP (DECL_RTL (current_function_decl), 0)));}/* Return 1 if OP is a valid operand for the MEM of a CALL insn. */intcall_operand (op, mode) rtx op; enum machine_mode mode;{ if (mode != Pmode) return 0; return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == REG);}/* Return 1 if OP is a valid Alpha comparison operator. Here we know which comparisons are valid in which insn. */intalpha_comparison_operator (op, mode) register rtx op; enum machine_mode mode;{ enum rtx_code code = GET_CODE (op); if (mode != GET_MODE (op) || GET_RTX_CLASS (code) != '<') return 0; return (code == EQ || code == LE || code == LT || (mode == DImode && (code == LEU || code == LTU)));}/* Return 1 if OP is a signed comparison operation. */intsigned_comparison_operator (op, mode) register rtx op; enum machine_mode mode;{ switch (GET_CODE (op)) { case EQ: case NE: case LE: case LT: case GE: case GT: return 1; } return 0;}/* Return 1 if this is a divide or modulus operator. */intdivmod_operator (op, mode) register rtx op; enum machine_mode mode;{ switch (GET_CODE (op)) { case DIV: case MOD: case UDIV: case UMOD: return 1; } return 0;}/* Return 1 if this memory address is a known aligned register plus a constant. It must be a valid address. This means that we can do this as an aligned reference plus some offset.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -