diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-04-22 10:21:45 +0000 |
---|---|---|
committer | <> | 2015-04-25 21:44:09 +0000 |
commit | f80b5ea1605c9f9408c5aa386ba71c16d918ebbf (patch) | |
tree | bb7eafaa81fc4b8c5c215bc08d517fd158db234a /gcc/rtl.c | |
parent | c27a97d04853380f1e80525391b3f0d156ed4c84 (diff) | |
download | gcc-tarball-f80b5ea1605c9f9408c5aa386ba71c16d918ebbf.tar.gz |
Imported from /home/lorry/working-area/delta_gcc-tarball/gcc-5.1.0.tar.bz2.gcc-5.1.0
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r-- | gcc/rtl.c | 136 |
1 files changed, 52 insertions, 84 deletions
@@ -1,5 +1,5 @@ /* RTL utility routines. - Copyright (C) 1987-2014 Free Software Foundation, Inc. + Copyright (C) 1987-2015 Free Software Foundation, Inc. This file is part of GCC. @@ -28,11 +28,12 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tm.h" -#include "rtl.h" #include "ggc.h" +#include "rtl.h" #ifdef GENERATOR_FILE # include "errors.h" #else +# include "rtlhash.h" # include "diagnostic-core.h" #endif @@ -109,7 +110,7 @@ const enum rtx_class rtx_class[NUM_RTX_CODE] = { const unsigned char rtx_code_size[NUM_RTX_CODE] = { #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \ (((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \ - || (ENUM) == CONST_FIXED) \ + || (ENUM) == CONST_FIXED || (ENUM) == CONST_WIDE_INT) \ ? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \ : RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (rtunion)), @@ -181,18 +182,24 @@ shallow_copy_rtvec (rtvec vec) unsigned int rtx_size (const_rtx x) { + if (CONST_WIDE_INT_P (x)) + return (RTX_HDR_SIZE + + sizeof (struct hwivec_def) + + ((CONST_WIDE_INT_NUNITS (x) - 1) + * sizeof (HOST_WIDE_INT))); if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_HAS_BLOCK_INFO_P (x)) return RTX_HDR_SIZE + sizeof (struct block_symbol); return RTX_CODE_SIZE (GET_CODE (x)); } -/* Allocate an rtx of code CODE. The CODE is stored in the rtx; - all the rest is initialized to zero. */ +/* Allocate an rtx of code CODE with EXTRA bytes in it. The CODE is + stored in the rtx; all the rest is initialized to zero. */ rtx -rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL) +rtx_alloc_stat_v (RTX_CODE code MEM_STAT_DECL, int extra) { - rtx rt = ggc_alloc_rtx_def_stat (RTX_CODE_SIZE (code) PASS_MEM_STAT); + rtx rt = ggc_alloc_rtx_def_stat (RTX_CODE_SIZE (code) + extra + PASS_MEM_STAT); /* We want to clear everything up to the FLD array. Normally, this is one int, but we don't want to assume that and it isn't very @@ -210,6 +217,31 @@ rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL) return rt; } +/* Allocate an rtx of code CODE. The CODE is stored in the rtx; + all the rest is initialized to zero. */ + +rtx +rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL) +{ + return rtx_alloc_stat_v (code PASS_MEM_STAT, 0); +} + +/* Write the wide constant X to OUTFILE. */ + +void +cwi_output_hex (FILE *outfile, const_rtx x) +{ + int i = CWI_GET_NUM_ELEM (x); + gcc_assert (i > 0); + if (CWI_ELT (x, i - 1) == 0) + /* The HOST_WIDE_INT_PRINT_HEX prepends a 0x only if the val is + non zero. We want all numbers to have a 0x prefix. */ + fprintf (outfile, "0x"); + fprintf (outfile, HOST_WIDE_INT_PRINT_HEX, CWI_ELT (x, --i)); + while (--i >= 0) + fprintf (outfile, HOST_WIDE_INT_PRINT_PADDED_HEX, CWI_ELT (x, i)); +} + /* Return true if ORIG is a sharable CONST. */ @@ -390,7 +422,7 @@ rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb) return (REGNO (x) == REGNO (y)); case LABEL_REF: - return XEXP (x, 0) == XEXP (y, 0); + return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y); case SYMBOL_REF: return XSTR (x, 0) == XSTR (y, 0); @@ -527,7 +559,7 @@ rtx_equal_p (const_rtx x, const_rtx y) return (REGNO (x) == REGNO (y)); case LABEL_REF: - return XEXP (x, 0) == XEXP (y, 0); + return LABEL_REF_LABEL (x) == LABEL_REF_LABEL (y); case SYMBOL_REF: return XSTR (x, 0) == XSTR (y, 0); @@ -623,80 +655,6 @@ rtx_equal_p (const_rtx x, const_rtx y) return 1; } -/* Iteratively hash rtx X. */ - -hashval_t -iterative_hash_rtx (const_rtx x, hashval_t hash) -{ - enum rtx_code code; - enum machine_mode mode; - int i, j; - const char *fmt; - - if (x == NULL_RTX) - return hash; - code = GET_CODE (x); - hash = iterative_hash_object (code, hash); - mode = GET_MODE (x); - hash = iterative_hash_object (mode, hash); - switch (code) - { - case REG: - i = REGNO (x); - return iterative_hash_object (i, hash); - case CONST_INT: - return iterative_hash_object (INTVAL (x), hash); - case SYMBOL_REF: - if (XSTR (x, 0)) - return iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1, - hash); - return hash; - case LABEL_REF: - case DEBUG_EXPR: - case VALUE: - case SCRATCH: - case CONST_DOUBLE: - case CONST_FIXED: - case DEBUG_IMPLICIT_PTR: - case DEBUG_PARAMETER_REF: - return hash; - default: - break; - } - - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - switch (fmt[i]) - { - case 'w': - hash = iterative_hash_object (XWINT (x, i), hash); - break; - case 'n': - case 'i': - hash = iterative_hash_object (XINT (x, i), hash); - break; - case 'V': - case 'E': - j = XVECLEN (x, i); - hash = iterative_hash_object (j, hash); - for (j = 0; j < XVECLEN (x, i); j++) - hash = iterative_hash_rtx (XVECEXP (x, i, j), hash); - break; - case 'e': - hash = iterative_hash_rtx (XEXP (x, i), hash); - break; - case 'S': - case 's': - if (XSTR (x, i)) - hash = iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1, - hash); - break; - default: - break; - } - return hash; -} - void dump_rtx_statistics (void) { @@ -784,7 +742,7 @@ rtl_check_failed_code2 (const_rtx r, enum rtx_code code1, enum rtx_code code2, } void -rtl_check_failed_code_mode (const_rtx r, enum rtx_code code, enum machine_mode mode, +rtl_check_failed_code_mode (const_rtx r, enum rtx_code code, machine_mode mode, bool not_mode, const char *file, int line, const char *func) { @@ -811,6 +769,16 @@ rtl_check_failed_block_symbol (const char *file, int line, const char *func) /* XXX Maybe print the vector? */ void +cwi_check_failed_bounds (const_rtx x, int n, const char *file, int line, + const char *func) +{ + internal_error + ("RTL check: access of hwi elt %d of vector with last elt %d in %s, at %s:%d", + n, CWI_GET_NUM_ELEM (x) - 1, func, trim_filename (file), line); +} + +/* XXX Maybe print the vector? */ +void rtvec_check_failed_bounds (const_rtvec r, int n, const char *file, int line, const char *func) { |