aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2007-07-25 15:43:04 +0000
committerJulian Brown <jules@gcc.gnu.org>2007-07-25 15:43:04 +0000
commit608063c3e9f54f45579ed601bb71c1e30b3e98aa (patch)
tree0134a32da12d27e340838fbc13221a2c4fe20a54 /gcc/cp/mangle.c
parent18efbe51766315fbe4d23dd710f22eab09ee826a (diff)
downloadgcc-608063c3e9f54f45579ed601bb71c1e30b3e98aa.zip
gcc-608063c3e9f54f45579ed601bb71c1e30b3e98aa.tar.gz
gcc-608063c3e9f54f45579ed601bb71c1e30b3e98aa.tar.bz2
alpha.c (alpha_mangle_fundamental_type): Rename to...
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. Co-Authored-By: Mark Shinwell <shinwell@codesourcery.com> From-SVN: r126917
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r--gcc/cp/mangle.c171
1 files changed, 88 insertions, 83 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 5a66b46..5452f6c 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1575,21 +1575,18 @@ write_type (tree type)
write_array_type (type);
else
{
+ tree type_orig = type;
+
/* See through any typedefs. */
type = TYPE_MAIN_VARIANT (type);
if (TYPE_PTRMEM_P (type))
write_pointer_to_member_type (type);
- else switch (TREE_CODE (type))
- {
- case VOID_TYPE:
- case BOOLEAN_TYPE:
- case INTEGER_TYPE: /* Includes wchar_t. */
- case REAL_TYPE:
- {
+ else
+ {
/* Handle any target-specific fundamental types. */
const char *target_mangling
- = targetm.mangle_fundamental_type (type);
+ = targetm.mangle_type (type_orig);
if (target_mangling)
{
@@ -1597,81 +1594,89 @@ write_type (tree type)
return;
}
- /* If this is a typedef, TYPE may not be one of
- the standard builtin type nodes, but an alias of one. Use
- TYPE_MAIN_VARIANT to get to the underlying builtin type. */
- write_builtin_type (TYPE_MAIN_VARIANT (type));
- ++is_builtin_type;
- break;
- }
-
- case COMPLEX_TYPE:
- write_char ('C');
- write_type (TREE_TYPE (type));
- break;
-
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- write_function_type (type);
- break;
-
- case UNION_TYPE:
- case RECORD_TYPE:
- case ENUMERAL_TYPE:
- /* A pointer-to-member function is represented as a special
- RECORD_TYPE, so check for this first. */
- if (TYPE_PTRMEMFUNC_P (type))
- write_pointer_to_member_type (type);
- else
- write_class_enum_type (type);
- break;
-
- case TYPENAME_TYPE:
- case UNBOUND_CLASS_TEMPLATE:
- /* We handle TYPENAME_TYPEs and UNBOUND_CLASS_TEMPLATEs like
- ordinary nested names. */
- write_nested_name (TYPE_STUB_DECL (type));
- break;
-
- case POINTER_TYPE:
- write_char ('P');
- write_type (TREE_TYPE (type));
- break;
-
- case REFERENCE_TYPE:
- if (TYPE_REF_IS_RVALUE (type))
- write_char('R');
- write_char ('R');
- write_type (TREE_TYPE (type));
- break;
-
- case TEMPLATE_TYPE_PARM:
- case TEMPLATE_PARM_INDEX:
- write_template_param (type);
- break;
-
- case TEMPLATE_TEMPLATE_PARM:
- write_template_template_param (type);
- break;
-
- case BOUND_TEMPLATE_TEMPLATE_PARM:
- write_template_template_param (type);
- write_template_args
- (TI_ARGS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (type)));
- break;
-
- case VECTOR_TYPE:
- write_string ("U8__vector");
- write_type (TREE_TYPE (type));
- break;
-
- case TYPE_PACK_EXPANSION:
- write_string ("U10__variadic");
- write_type (PACK_EXPANSION_PATTERN (type));
- break;
-
- default:
- gcc_unreachable ();
+ switch (TREE_CODE (type))
+ {
+ case VOID_TYPE:
+ case BOOLEAN_TYPE:
+ case INTEGER_TYPE: /* Includes wchar_t. */
+ case REAL_TYPE:
+ {
+ /* If this is a typedef, TYPE may not be one of
+ the standard builtin type nodes, but an alias of one. Use
+ TYPE_MAIN_VARIANT to get to the underlying builtin type. */
+ write_builtin_type (TYPE_MAIN_VARIANT (type));
+ ++is_builtin_type;
+ }
+ break;
+
+ case COMPLEX_TYPE:
+ write_char ('C');
+ write_type (TREE_TYPE (type));
+ break;
+
+ case FUNCTION_TYPE:
+ case METHOD_TYPE:
+ write_function_type (type);
+ break;
+
+ case UNION_TYPE:
+ case RECORD_TYPE:
+ case ENUMERAL_TYPE:
+ /* A pointer-to-member function is represented as a special
+ RECORD_TYPE, so check for this first. */
+ if (TYPE_PTRMEMFUNC_P (type))
+ write_pointer_to_member_type (type);
+ else
+ write_class_enum_type (type);
+ break;
+
+ case TYPENAME_TYPE:
+ case UNBOUND_CLASS_TEMPLATE:
+ /* We handle TYPENAME_TYPEs and UNBOUND_CLASS_TEMPLATEs like
+ ordinary nested names. */
+ write_nested_name (TYPE_STUB_DECL (type));
+ break;
+
+ case POINTER_TYPE:
+ write_char ('P');
+ write_type (TREE_TYPE (type));
+ break;
+
+ case REFERENCE_TYPE:
+ if (TYPE_REF_IS_RVALUE (type))
+ write_char('R');
+ write_char ('R');
+ write_type (TREE_TYPE (type));
+ break;
+
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_PARM_INDEX:
+ write_template_param (type);
+ break;
+
+ case TEMPLATE_TEMPLATE_PARM:
+ write_template_template_param (type);
+ break;
+
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ write_template_template_param (type);
+ write_template_args
+ (TI_ARGS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (type)));
+ break;
+
+ case VECTOR_TYPE:
+ write_string ("U8__vector");
+ write_type (TREE_TYPE (type));
+ break;
+
+ case TYPE_PACK_EXPANSION:
+ write_string ("U10__variadic");
+ write_type (PACK_EXPANSION_PATTERN (type));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
}
}