diff options
author | jules <jules@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-25 15:43:04 +0000 |
---|---|---|
committer | jules <jules@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-25 15:43:04 +0000 |
commit | eddcdde1c8527beb465e468f37673a0c358d5018 (patch) | |
tree | 0134a32da12d27e340838fbc13221a2c4fe20a54 /gcc/config | |
parent | 53974ec6f7a3c2ac1afe37e853d0fde4e168da69 (diff) | |
download | gcc-eddcdde1c8527beb465e468f37673a0c358d5018.tar.gz |
gcc/
* config/alpha/alpha.c (alpha_mangle_fundamental_type): Rename to...
(alpha_mangle_type): This.
(TARGET_MANGLE_FUNDAMENTAL_TYPE): Don't define.
(TARGET_MANGLE_TYPE): Define this instead.
* config/arm/arm-protos.h (arm_mangle_type): Add prototype.
* config/arm/arm.c (TARGET_MANGLE_TYPE): Define target hook.
(arm_init_neon_builtins): Fix comment.
(arm_mangle_map_entry): New.
(arm_mangle_map): New.
(arm_mangle_type): New.
* config/i386/i386.c (ix86_mangle_fundamental_type): Rename to...
(ix86_mangle_type): This. Use TYPE_MAIN_VARIANT and restrict
mangled types to VOID_TYPE, BOOLEAN_TYPE, INTEGER_TYPE, REAL_TYPE.
(TARGET_MANGLE_FUNDAMENTAL_TYPE): Don't define.
(TARGET_MANGLE_TYPE): Define this instead.
* config/ia64/ia64.c (ia64_mangle_fundamental_type): Rename to...
(ia64_mangle_type): This. Use TYPE_MAIN_VARIANT and restrict
mangled types to VOID_TYPE, BOOLEAN_TYPE, INTEGER_TYPE, REAL_TYPE.
(TARGET_MANGLE_FUNDAMENTAL_TYPE): Don't define.
(TARGET_MANGLE_TYPE): Define this instead.
* config/rs6000/rs6000.c (rs6000_mangle_fundamental_type): Rename
to...
(rs6000_mangle_type): This. Use TYPE_MAIN_VARIANT.
(TARGET_MANGLE_FUNDAMENTAL_TYPE): Don't define.
(TARGET_MANGLE_TYPE): Define this instead.
* config/s390/s390.c (s390_mangle_fundamental_type): Rename to...
(s390_mangle_type): This.
(TARGET_MANGLE_FUNDAMENTAL_TYPE): Don't define.
(TARGET_MANGLE_TYPE): Define this instead.
* config/sparc/sparc.c (sparc_mangle_fundamental_type): Rename to...
(sparc_mangle_type): This.
(TARGET_MANGLE_FUNDAMENTAL_TYPE): Don't define.
(TARGET_MANGLE_TYPE): Define this instead.
* cp/mangle.c (write_type): Call mangle_type target hook on all
types before mangling. Use original type, not main variant, as
argument.
* target-def.h (TARGET_MANGLE_FUNDAMENTAL_TYPE): Rename hook to...
(TARGET_MANGLE_TYPE): This.
* target.h (gcc_target): Rename mangle_fundamental_type to
mangle_type.
* doc/tm.texi (TARGET_MANGLE_FUNDAMENTAL_TYPE): Rename section to...
(TARGET_MANGLE_TYPE): This. Note slightly different semantics.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126917 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/alpha/alpha.c | 8 | ||||
-rw-r--r-- | gcc/config/arm/arm-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 70 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 12 | ||||
-rw-r--r-- | gcc/config/ia64/ia64.c | 14 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 14 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 8 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 10 |
8 files changed, 113 insertions, 25 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index c50055f33df..03edfee8af0 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -238,10 +238,10 @@ alpha_handle_option (size_t code, const char *arg, int value) } #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING -/* Implement TARGET_MANGLE_FUNDAMENTAL_TYPE. */ +/* Implement TARGET_MANGLE_TYPE. */ static const char * -alpha_mangle_fundamental_type (tree type) +alpha_mangle_type (tree type) { if (TYPE_MAIN_VARIANT (type) == long_double_type_node && TARGET_LONG_DOUBLE_128) @@ -10709,8 +10709,8 @@ alpha_init_libfuncs (void) #define TARGET_HANDLE_OPTION alpha_handle_option #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING -#undef TARGET_MANGLE_FUNDAMENTAL_TYPE -#define TARGET_MANGLE_FUNDAMENTAL_TYPE alpha_mangle_fundamental_type +#undef TARGET_MANGLE_TYPE +#define TARGET_MANGLE_TYPE alpha_mangle_type #endif struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index a877c6df19a..000775d7894 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -211,4 +211,6 @@ extern void arm_pr_long_calls (struct cpp_reader *); extern void arm_pr_no_long_calls (struct cpp_reader *); extern void arm_pr_long_calls_off (struct cpp_reader *); +extern const char *arm_mangle_type (tree); + #endif /* ! GCC_ARM_PROTOS_H */ diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 94926d8b554..68aa89e49f5 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -382,6 +382,9 @@ static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM arm_cannot_force_const_mem +#undef TARGET_MANGLE_TYPE +#define TARGET_MANGLE_TYPE arm_mangle_type + #ifdef HAVE_AS_TLS #undef TARGET_ASM_OUTPUT_DWARF_DTPREL #define TARGET_ASM_OUTPUT_DWARF_DTPREL arm_output_dwarf_dtprel @@ -14846,7 +14849,7 @@ arm_init_neon_builtins (void) /* Define typedefs which exactly correspond to the modes we are basing vector types on. If you change these names you'll need to change - the table used by arm_mangle_vector_type too. */ + the table used by arm_mangle_type too. */ (*lang_hooks.types.register_builtin_type) (neon_intQI_type_node, "__builtin_neon_qi"); (*lang_hooks.types.register_builtin_type) (neon_intHI_type_node, @@ -18850,4 +18853,69 @@ thumb2_output_casesi (rtx *operands) } } +/* A table and a function to perform ARM-specific name mangling for + NEON vector types in order to conform to the AAPCS (see "Procedure + Call Standard for the ARM Architecture", Appendix A). To qualify + for emission with the mangled names defined in that document, a + vector type must not only be of the correct mode but also be + composed of NEON vector element types (e.g. __builtin_neon_qi). */ +typedef struct +{ + enum machine_mode mode; + const char *element_type_name; + const char *aapcs_name; +} arm_mangle_map_entry; + +static arm_mangle_map_entry arm_mangle_map[] = { + /* 64-bit containerized types. */ + { V8QImode, "__builtin_neon_qi", "15__simd64_int8_t" }, + { V8QImode, "__builtin_neon_uqi", "16__simd64_uint8_t" }, + { V4HImode, "__builtin_neon_hi", "16__simd64_int16_t" }, + { V4HImode, "__builtin_neon_uhi", "17__simd64_uint16_t" }, + { V2SImode, "__builtin_neon_si", "16__simd64_int32_t" }, + { V2SImode, "__builtin_neon_usi", "17__simd64_uint32_t" }, + { V2SFmode, "__builtin_neon_sf", "18__simd64_float32_t" }, + { V8QImode, "__builtin_neon_poly8", "16__simd64_poly8_t" }, + { V4HImode, "__builtin_neon_poly16", "17__simd64_poly16_t" }, + /* 128-bit containerized types. */ + { V16QImode, "__builtin_neon_qi", "16__simd128_int8_t" }, + { V16QImode, "__builtin_neon_uqi", "17__simd128_uint8_t" }, + { V8HImode, "__builtin_neon_hi", "17__simd128_int16_t" }, + { V8HImode, "__builtin_neon_uhi", "18__simd128_uint16_t" }, + { V4SImode, "__builtin_neon_si", "17__simd128_int32_t" }, + { V4SImode, "__builtin_neon_usi", "18__simd128_uint32_t" }, + { V4SFmode, "__builtin_neon_sf", "19__simd128_float32_t" }, + { V16QImode, "__builtin_neon_poly8", "17__simd128_poly8_t" }, + { V8HImode, "__builtin_neon_poly16", "18__simd128_poly16_t" }, + { VOIDmode, NULL, NULL } +}; + +const char * +arm_mangle_type (tree type) +{ + arm_mangle_map_entry *pos = arm_mangle_map; + + if (TREE_CODE (type) != VECTOR_TYPE) + return NULL; + + /* Check the mode of the vector type, and the name of the vector + element type, against the table. */ + while (pos->mode != VOIDmode) + { + tree elt_type = TREE_TYPE (type); + + if (pos->mode == TYPE_MODE (type) + && TREE_CODE (TYPE_NAME (elt_type)) == TYPE_DECL + && !strcmp (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (elt_type))), + pos->element_type_name)) + return pos->aapcs_name; + + pos++; + } + + /* Use the default mangling for unrecognized (possibly user-defined) + vector types. */ + return NULL; +} + #include "gt-arm.h" diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 2ad01df373f..1ddd60de66e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -22761,8 +22761,14 @@ i386_solaris_elf_named_section (const char *name, unsigned int flags, /* Return the mangling of TYPE if it is an extended fundamental type. */ static const char * -ix86_mangle_fundamental_type (tree type) +ix86_mangle_type (tree type) { + type = TYPE_MAIN_VARIANT (type); + + if (TREE_CODE (type) != VOID_TYPE && TREE_CODE (type) != BOOLEAN_TYPE + && TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE) + return NULL; + switch (TYPE_MODE (type)) { case TFmode: @@ -23593,8 +23599,8 @@ static const struct attribute_spec ix86_attribute_table[] = #define TARGET_INSERT_ATTRIBUTES SUBTARGET_INSERT_ATTRIBUTES #endif -#undef TARGET_MANGLE_FUNDAMENTAL_TYPE -#define TARGET_MANGLE_FUNDAMENTAL_TYPE ix86_mangle_fundamental_type +#undef TARGET_MANGLE_TYPE +#define TARGET_MANGLE_TYPE ix86_mangle_type #undef TARGET_STACK_PROTECT_FAIL #define TARGET_STACK_PROTECT_FAIL ix86_stack_protect_fail diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 9a5bcd95ea9..a07374b1fa9 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -279,7 +279,7 @@ static tree ia64_gimplify_va_arg (tree, tree, tree *, tree *); static bool ia64_scalar_mode_supported_p (enum machine_mode mode); static bool ia64_vector_mode_supported_p (enum machine_mode mode); static bool ia64_cannot_force_const_mem (rtx); -static const char *ia64_mangle_fundamental_type (tree); +static const char *ia64_mangle_type (tree); static const char *ia64_invalid_conversion (tree, tree); static const char *ia64_invalid_unary_op (int, tree); static const char *ia64_invalid_binary_op (int, tree, tree); @@ -476,8 +476,8 @@ static const struct attribute_spec ia64_attribute_table[] = #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM ia64_cannot_force_const_mem -#undef TARGET_MANGLE_FUNDAMENTAL_TYPE -#define TARGET_MANGLE_FUNDAMENTAL_TYPE ia64_mangle_fundamental_type +#undef TARGET_MANGLE_TYPE +#define TARGET_MANGLE_TYPE ia64_mangle_type #undef TARGET_INVALID_CONVERSION #define TARGET_INVALID_CONVERSION ia64_invalid_conversion @@ -9739,8 +9739,14 @@ ia64_profile_hook (int labelno) /* Return the mangling of TYPE if it is an extended fundamental type. */ static const char * -ia64_mangle_fundamental_type (tree type) +ia64_mangle_type (tree type) { + type = TYPE_MAIN_VARIANT (type); + + if (TREE_CODE (type) != VOID_TYPE && TREE_CODE (type) != BOOLEAN_TYPE + && TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE) + return NULL; + /* On HP-UX, "long double" is mangled as "e" so __float128 is mangled as "e". */ if (!TARGET_HPUX && TYPE_MODE (type) == TFmode) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 93a742a0418..f2cb51fc551 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -710,7 +710,7 @@ static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *); static bool rs6000_ms_bitfield_layout_p (tree); static tree rs6000_handle_struct_attribute (tree *, tree, tree, int, bool *); static void rs6000_eliminate_indexed_memrefs (rtx operands[2]); -static const char *rs6000_mangle_fundamental_type (tree); +static const char *rs6000_mangle_type (tree); extern const struct attribute_spec rs6000_attribute_table[]; static void rs6000_set_default_type_attributes (tree); static bool rs6000_reg_live_or_pic_offset_p (int); @@ -1061,8 +1061,8 @@ static const char alt_reg_names[][8] = #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN rs6000_expand_builtin -#undef TARGET_MANGLE_FUNDAMENTAL_TYPE -#define TARGET_MANGLE_FUNDAMENTAL_TYPE rs6000_mangle_fundamental_type +#undef TARGET_MANGLE_TYPE +#define TARGET_MANGLE_TYPE rs6000_mangle_type #undef TARGET_INIT_LIBFUNCS #define TARGET_INIT_LIBFUNCS rs6000_init_libfuncs @@ -18959,8 +18959,14 @@ rs6000_handle_altivec_attribute (tree *node, elements; we must teach the compiler how to mangle them. */ static const char * -rs6000_mangle_fundamental_type (tree type) +rs6000_mangle_type (tree type) { + type = TYPE_MAIN_VARIANT (type); + + if (TREE_CODE (type) != VOID_TYPE && TREE_CODE (type) != BOOLEAN_TYPE + && TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE) + return NULL; + if (type == bool_char_type_node) return "U6__boolc"; if (type == bool_short_type_node) return "U6__bools"; if (type == pixel_type_node) return "u7__pixel"; diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 1af654fdf21..979c167ef76 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -4368,10 +4368,10 @@ s390_output_dwarf_dtprel (FILE *file, int size, rtx x) } #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING -/* Implement TARGET_MANGLE_FUNDAMENTAL_TYPE. */ +/* Implement TARGET_MANGLE_TYPE. */ static const char * -s390_mangle_fundamental_type (tree type) +s390_mangle_type (tree type) { if (TYPE_MAIN_VARIANT (type) == long_double_type_node && TARGET_LONG_DOUBLE_128) @@ -9343,8 +9343,8 @@ s390_reorg (void) #endif #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING -#undef TARGET_MANGLE_FUNDAMENTAL_TYPE -#define TARGET_MANGLE_FUNDAMENTAL_TYPE s390_mangle_fundamental_type +#undef TARGET_MANGLE_TYPE +#define TARGET_MANGLE_TYPE s390_mangle_type #endif #undef TARGET_SCALAR_MODE_SUPPORTED_P diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index ef2ba7c8219..05c754110af 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -396,7 +396,7 @@ static void sparc_dwarf_handle_frame_unspec (const char *, rtx, int); static void sparc_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; static void sparc_file_end (void); #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING -static const char *sparc_mangle_fundamental_type (tree); +static const char *sparc_mangle_type (tree); #endif #ifdef SUBTARGET_ATTRIBUTE_TABLE const struct attribute_spec sparc_attribute_table[]; @@ -558,8 +558,8 @@ static bool fpu_option_set = false; #define TARGET_ASM_FILE_END sparc_file_end #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING -#undef TARGET_MANGLE_FUNDAMENTAL_TYPE -#define TARGET_MANGLE_FUNDAMENTAL_TYPE sparc_mangle_fundamental_type +#undef TARGET_MANGLE_TYPE +#define TARGET_MANGLE_TYPE sparc_mangle_type #endif struct gcc_target targetm = TARGET_INITIALIZER; @@ -8888,10 +8888,10 @@ sparc_file_end (void) } #ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING -/* Implement TARGET_MANGLE_FUNDAMENTAL_TYPE. */ +/* Implement TARGET_MANGLE_TYPE. */ static const char * -sparc_mangle_fundamental_type (tree type) +sparc_mangle_type (tree type) { if (!TARGET_64BIT && TYPE_MAIN_VARIANT (type) == long_double_type_node |