This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[named-addr-spaces-branch][Patch,committed] Fix C++ bug; Add common pointer target hook
- From: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 30 Nov 2008 16:55:56 -0500
- Subject: [named-addr-spaces-branch][Patch,committed] Fix C++ bug; Add common pointer target hook
This patch fixes a bug in running the C++ test suite on hosted compilers that I
introduced with the named address support.
I also added a hook for common_pointer_type to pick an appropriate named
address space when dealing with pointers to two different named address
spaces.
I did some cleanup as well.
2008-11-30 Michael Meissner <meissner@linux.vnet.ibm.com>
* targhook.c (default_addr_space_common_pointer): New default hook
for determining whether there is a common pointer format to use
between two pointers.
* targhook.h (default_addr_space_common_pointer): Add
declaration.
* tree.c (integer_pow2p): Rewrite to eliminate the macro
OTHER_ADDR_SPACE_POINTER_TYPE_P.
(tree_log2): Ditto.
(tree_floor_log2): Ditto.
(build_pointer_type_for_mode): Add support for being passed
error_mark_node.
(build_reference_type_for_mode): Add named address space support.
* tree.h (OTHER_ADDR_SPACE_POINTER_TYPE_P): Delete.
(GENERIC_ADDR_SPACE_POINTER_TYPE_P): Ditto.
* target.h (struct addr_space): Add new hook to determine whether
there is a common pointer pointer to use between two pointers.
Change pointer_mode argument to addr_space_t from int.
* fold-const.c (fit_double_type): Rewrite to eliminate the macro
OTHER_ADDR_SPACE_POINTER_TYPE_P. Get the named address space from
the type the pointer points to instead of the pointer itself.
(fold_convert_const): Ditto.
* tree-ssa-loop-ivopts.c (strip_offset): Rewrite to eliminate the
macros OTHER_ADDR_SPACE_POINTER_TYPE_P and
GENERIC_ADDR_SPACE_POINTER_TYPE_P.
* expr.c (expand_expr_addr_expr): Rewrite to eliminate the macro
OTHER_ADDR_SPACE_POINTER_TYPE_P.
* c-typechk.c (common_pointer_type): Determine what named address
space should be used if pointers to two different named address spaces.
(build_binary_op): Rewrite to eliminate the macro
OTHER_ADDR_SPACE_POINTER_TYPE_P.
* varasm.c (default_addr_space_pointer_mode): Change argument type.
* tree-ssa.c (useless_type_conversion_p_1): Rewrite to eliminate
the macro GENERIC_ADDR_SPACE_POINTER_TYPE_P.
* target-def.h (TARGET_ADDR_SPACE_COMMON_POINTER): New target hook
for determining what named address space should be used when two
pointers are combined.
(TARGET_ADDR_SPACE_HOOKS): Add TARGET_ADDR_SPACE_COMMON_POINTER.
* output.h (default_addr_space_pointer_mode): Change argument
type.
* config/spu/spu.c (spu_addr_space_common_pointer): New target
hook to return what address space to use between two pointers.
(TARGET_ADDR_SPACE_COMMON_POINTER): Define target hook.
(spu_ea_pointer_mode): Change argument from int to addr_space_t.
(spu_addr_space_can_convert_p): Use TARGET_NO_LOCAL_EA_CONVERSION
instead of TARGET_NO_EA_LOCAL_CONVERSION.
* config/spu/spu.opt (-mno-local-ea-conversion): Make mask
correspond with switch.
(-mlocal-ea-conversion): Ditto.
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c (revision 142261)
+++ gcc/targhooks.c (working copy)
@@ -739,6 +739,18 @@ default_addr_space_nop_convert_p (addr_s
return to_addr == from_addr;
}
+/* The default hook for determining whether there is a common pointer format to
+ use when two pointers are used together. */
+
+addr_space_t
+default_addr_space_common_pointer (addr_space_t addr1, addr_space_t addr2)
+{
+ if (addr1 == addr2)
+ return addr1;
+
+ gcc_unreachable ();
+}
+
/* The default hook for TARGET_ADDR_SPACE_CONVERT. This hook should never be
called for targets with only a generic address space. */
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h (revision 142261)
+++ gcc/targhooks.h (working copy)
@@ -110,4 +110,6 @@ extern rtx default_addr_space_convert (r
addr_space_t);
extern bool default_addr_space_can_convert_p (addr_space_t, addr_space_t);
extern bool default_addr_space_nop_convert_p (addr_space_t, addr_space_t);
+extern addr_space_t default_addr_space_common_pointer (addr_space_t,
+ addr_space_t);
extern tree default_addr_space_section_name (addr_space_t);
Index: gcc/tree.c
===================================================================
--- gcc/tree.c (revision 142261)
+++ gcc/tree.c (working copy)
@@ -1478,14 +1478,14 @@ integer_pow2p (const_tree expr)
if (TREE_CODE (expr) != INTEGER_CST)
return 0;
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (TREE_TYPE (expr)))
+ if (POINTER_TYPE_P (TREE_TYPE (expr)))
{
- addr_space_t addr_space = TYPE_ADDR_SPACE (TREE_TYPE (expr));
- enum machine_mode mode = targetm.addr_space.pointer_mode (addr_space);
- prec = GET_MODE_BITSIZE (mode);
+ addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (expr));
+ if (as)
+ prec = GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (as));
+ else
+ prec = POINTER_SIZE;
}
- else if (POINTER_TYPE_P (TREE_TYPE (expr)))
- prec = POINTER_SIZE;
else
prec = TYPE_PRECISION (TREE_TYPE (expr));
@@ -1552,14 +1552,14 @@ tree_log2 (const_tree expr)
if (TREE_CODE (expr) == COMPLEX_CST)
return tree_log2 (TREE_REALPART (expr));
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (TREE_TYPE (expr)))
+ if (POINTER_TYPE_P (TREE_TYPE (expr)))
{
- addr_space_t addr_space = TYPE_ADDR_SPACE (TREE_TYPE (expr));
- enum machine_mode mode = targetm.addr_space.pointer_mode (addr_space);
- prec = GET_MODE_BITSIZE (mode);
+ addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (expr));
+ if (as)
+ prec = GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (as));
+ else
+ prec = POINTER_SIZE;
}
- else if (POINTER_TYPE_P (TREE_TYPE (expr)))
- prec = POINTER_SIZE;
else
prec = TYPE_PRECISION (TREE_TYPE (expr));
@@ -1598,14 +1598,14 @@ tree_floor_log2 (const_tree expr)
if (TREE_CODE (expr) == COMPLEX_CST)
return tree_log2 (TREE_REALPART (expr));
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (TREE_TYPE (expr)))
+ if (POINTER_TYPE_P (TREE_TYPE (expr)))
{
- addr_space_t addr_space = TYPE_ADDR_SPACE (TREE_TYPE (expr));
- enum machine_mode mode = targetm.addr_space.pointer_mode (addr_space);
- prec = GET_MODE_BITSIZE (mode);
+ addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (expr));
+ if (as)
+ prec = GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (as));
+ else
+ prec = POINTER_SIZE;
}
- else if (POINTER_TYPE_P (TREE_TYPE (expr)))
- prec = POINTER_SIZE;
else
prec = TYPE_PRECISION (TREE_TYPE (expr));
@@ -5572,8 +5572,16 @@ build_pointer_type_for_mode (tree to_typ
tree
build_pointer_type (tree to_type)
{
- addr_space_t addr_space = TYPE_ADDR_SPACE (to_type);
- enum machine_mode mode = targetm.addr_space.pointer_mode (addr_space);
+ addr_space_t addr_space;
+ enum machine_mode mode;
+
+ if (to_type == error_mark_node)
+ return error_mark_node;
+
+ addr_space = TYPE_ADDR_SPACE (to_type);
+ mode = ((addr_space)
+ ? targetm.addr_space.pointer_mode (addr_space)
+ : ptr_mode);
return build_pointer_type_for_mode (to_type, mode, false);
}
@@ -5638,7 +5646,17 @@ build_reference_type_for_mode (tree to_t
tree
build_reference_type (tree to_type)
{
- return build_reference_type_for_mode (to_type, ptr_mode, false);
+ addr_space_t addr_space;
+ enum machine_mode mode;
+
+ if (to_type == error_mark_node)
+ return error_mark_node;
+
+ addr_space = TYPE_ADDR_SPACE (to_type);
+ mode = ((addr_space)
+ ? targetm.addr_space.pointer_mode (addr_space)
+ : ptr_mode);
+ return build_reference_type_for_mode (to_type, mode, false);
}
/* Build a type that is compatible with t but has no cv quals anywhere
Index: gcc/tree.h
===================================================================
--- gcc/tree.h (revision 142287)
+++ gcc/tree.h (working copy)
@@ -1084,16 +1084,6 @@ extern void omp_clause_range_check_faile
#define POINTER_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)
-/* Nonzero if TYPE is a pointer or reference type qualified as belonging
- to an address space that is not the generic address space. */
-#define OTHER_ADDR_SPACE_POINTER_TYPE_P(TYPE) \
- (POINTER_TYPE_P (TYPE) && TYPE_ADDR_SPACE (strip_array_types (TREE_TYPE (TYPE))))
-
-/* Nonzero if TYPE is a pointer or reference type, but does not belong
- to an address space outside the generic address space. */
-#define GENERIC_ADDR_SPACE_POINTER_TYPE_P(TYPE) \
- (POINTER_TYPE_P (TYPE) && !TYPE_ADDR_SPACE (strip_array_types (TREE_TYPE (TYPE))))
-
/* Nonzero if this type is a complete type. */
#define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE)
Index: gcc/target.h
===================================================================
--- gcc/target.h (revision 142261)
+++ gcc/target.h (working copy)
@@ -665,7 +665,7 @@ struct gcc_target
/* Support for named address spaces. */
struct addr_space {
/* MODE to use for a pointer into another address space. */
- enum machine_mode (* pointer_mode) (int);
+ enum machine_mode (* pointer_mode) (addr_space_t);
/* Function to map an address space to a descriptive string. */
const char * (* name) (addr_space_t);
@@ -681,6 +681,10 @@ struct gcc_target
NOP. */
bool (* nop_convert_p) (addr_space_t, addr_space_t);
+ /* Return the named address space to use between pointers to different
+ named address spaces. */
+ addr_space_t (* common_pointer) (addr_space_t, addr_space_t);
+
/* Function to convert an rtl expression from one address space to
another. */
rtx (* convert) (rtx, enum machine_mode, addr_space_t, addr_space_t);
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c (revision 142261)
+++ gcc/fold-const.c (working copy)
@@ -203,13 +203,15 @@ fit_double_type (unsigned HOST_WIDE_INT
unsigned int prec;
int sign_extended_type;
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (type))
+ if (POINTER_TYPE_P (type))
{
- addr_space_t addr_space = TYPE_ADDR_SPACE (type);
- prec = GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (addr_space));
+ addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (type));
+ if (as)
+ prec = GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (as));
+ else
+ prec = POINTER_SIZE;
}
- else if (POINTER_TYPE_P (type)
- || TREE_CODE (type) == OFFSET_TYPE)
+ else if (TREE_CODE (type) == OFFSET_TYPE)
prec = POINTER_SIZE;
else
prec = TYPE_PRECISION (type);
@@ -2401,7 +2403,7 @@ fold_convert_const (enum tree_code code,
if (TREE_TYPE (arg1) == type)
return arg1;
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (type))
+ if (POINTER_TYPE_P (type) && TYPE_ADDR_SPACE (TREE_TYPE (type)))
return NULL_TREE;
else if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type)
|| TREE_CODE (type) == OFFSET_TYPE)
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
--- gcc/tree-ssa-loop-ivopts.c (revision 142261)
+++ gcc/tree-ssa-loop-ivopts.c (working copy)
@@ -2020,14 +2020,17 @@ strip_offset (tree expr, unsigned HOST_W
static tree
generic_type_for (tree type)
{
- if (GENERIC_ADDR_SPACE_POINTER_TYPE_P (type))
- return unsigned_type_for (type);
-
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (type))
+ if (POINTER_TYPE_P (type))
{
- int qual = ENCODE_QUAL_ADDR_SPACE (TYPE_ADDR_SPACE (TREE_TYPE (type)));
- return build_pointer_type
- (build_qualified_type (void_type_node, qual));
+ int qual;
+
+ addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (type));
+ if (!as) /* generic address space */
+ return unsigned_type_for (type);
+
+ /* named address space */
+ qual = ENCODE_QUAL_ADDR_SPACE (as);
+ return build_pointer_type (build_qualified_type (void_type_node, qual));
}
if (TYPE_UNSIGNED (type))
Index: gcc/expr.c
===================================================================
--- gcc/expr.c (revision 142287)
+++ gcc/expr.c (working copy)
@@ -6927,10 +6927,11 @@ expand_expr_addr_expr (tree exp, rtx tar
tmode = TYPE_MODE (TREE_TYPE (exp));
addrmode = Pmode;
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (TREE_TYPE (exp)))
+ if (POINTER_TYPE_P (TREE_TYPE (exp)))
{
- addr_space_t addr_space = TYPE_ADDR_SPACE (TREE_TYPE (exp));
- addrmode = targetm.addr_space.pointer_mode (addr_space);
+ addr_space_t addr_space = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp)));
+ if (addr_space)
+ addrmode = targetm.addr_space.pointer_mode (addr_space);
}
/* We can get called with some Weird Things if the user does silliness
Index: gcc/c-typeck.c
===================================================================
--- gcc/c-typeck.c (revision 142287)
+++ gcc/c-typeck.c (working copy)
@@ -532,6 +532,8 @@ common_pointer_type (tree t1, tree t2)
tree pointed_to_2, mv2;
tree target;
unsigned target_quals;
+ addr_space_t as1, as2, as_common;
+ int quals1, quals2;
/* Save time if the two types are the same. */
@@ -563,10 +565,24 @@ common_pointer_type (tree t1, tree t2)
/* For function types do not merge const qualifiers, but drop them
if used inconsistently. The middle-end uses these to mark const
and noreturn functions. */
+ quals1 = TYPE_QUALS_NO_ADDR_SPACE (pointed_to_1);
+ quals2 = TYPE_QUALS_NO_ADDR_SPACE (pointed_to_2);
+
if (TREE_CODE (pointed_to_1) == FUNCTION_TYPE)
- target_quals = TYPE_QUALS (pointed_to_1) & TYPE_QUALS (pointed_to_2);
+ target_quals = (quals1 & quals2);
else
- target_quals = TYPE_QUALS (pointed_to_1) | TYPE_QUALS (pointed_to_2);
+ target_quals = (quals1 | quals2);
+
+ /* Determine the address space to use if the pointers point to different
+ named address spaces. */
+ as1 = TYPE_ADDR_SPACE (pointed_to_1);
+ as2 = TYPE_ADDR_SPACE (pointed_to_2);
+ as_common = ((as1 == as2)
+ ? as1
+ : targetm.addr_space.common_pointer (as1, as2));
+
+ target_quals |= ENCODE_QUAL_ADDR_SPACE (as_common);
+
t1 = build_pointer_type (c_build_qualified_type (target, target_quals));
return build_type_attribute_variant (t1, attributes);
}
@@ -8288,6 +8304,8 @@ build_binary_op (location_t location, en
{
tree tt0 = TREE_TYPE (type0);
tree tt1 = TREE_TYPE (type1);
+ addr_space_t as;
+
/* Anything compares with void *. void * compares with anything.
Otherwise, the targets must be compatible
and both must be object or both incomplete. */
@@ -8305,9 +8323,10 @@ build_binary_op (location_t location, en
/* If this operand is a pointer into another address
space, make the result of the comparison such a
pointer also. */
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (type0))
+ if (POINTER_TYPE_P (type0)
+ && (as = TYPE_ADDR_SPACE (TREE_TYPE (type0))))
{
- int qual = ENCODE_QUAL_ADDR_SPACE (TYPE_ADDR_SPACE (TREE_TYPE (type0)));
+ int qual = ENCODE_QUAL_ADDR_SPACE (as);
result_type = build_pointer_type
(build_qualified_type (void_type_node, qual));
}
@@ -8322,9 +8341,10 @@ build_binary_op (location_t location, en
/* If this operand is a pointer into another address
space, make the result of the comparison such a
pointer also. */
- if (OTHER_ADDR_SPACE_POINTER_TYPE_P (type1))
+ if (POINTER_TYPE_P (type1)
+ && (as = TYPE_ADDR_SPACE (TREE_TYPE (type1))))
{
- int qual = ENCODE_QUAL_ADDR_SPACE (TYPE_ADDR_SPACE (TREE_TYPE (type1)));
+ int qual = ENCODE_QUAL_ADDR_SPACE (as);
result_type = build_pointer_type
(build_qualified_type (void_type_node, qual));
}
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c (revision 142261)
+++ gcc/varasm.c (working copy)
@@ -6347,7 +6347,7 @@ default_valid_pointer_mode (enum machine
/* Return the pointer mode for a given ADDRSPACE, defaulting to
ptr_mode for the generic address space only. */
enum machine_mode
-default_addr_space_pointer_mode (int addrspace)
+default_addr_space_pointer_mode (addr_space_t addrspace)
{
gcc_assert (addrspace == 0);
return ptr_mode;
Index: gcc/tree-ssa.c
===================================================================
--- gcc/tree-ssa.c (revision 142261)
+++ gcc/tree-ssa.c (working copy)
@@ -1235,12 +1235,14 @@ useless_type_conversion_p_1 (tree outer_
bool
useless_type_conversion_p (tree outer_type, tree inner_type)
{
- /* If the outer type is (void *), then the conversion is not
- necessary. We have to make sure to not apply this while
- recursing though. */
- if (GENERIC_ADDR_SPACE_POINTER_TYPE_P (inner_type)
- && GENERIC_ADDR_SPACE_POINTER_TYPE_P (outer_type)
- && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
+ /* If the outer type is (void *) and the pointers point to the same named
+ address space, then the conversion is not necessary. We have to make sure
+ to not apply this while recursing though. */
+ if (POINTER_TYPE_P (inner_type)
+ && POINTER_TYPE_P (outer_type)
+ && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE
+ && (TYPE_ADDR_SPACE (TREE_TYPE (inner_type))
+ == TYPE_ADDR_SPACE (TREE_TYPE (outer_type))))
return true;
return useless_type_conversion_p_1 (outer_type, inner_type);
Index: gcc/target-def.h
===================================================================
--- gcc/target-def.h (revision 142261)
+++ gcc/target-def.h (working copy)
@@ -477,6 +477,10 @@
#define TARGET_ADDR_SPACE_NOP_CONVERT_P default_addr_space_nop_convert_p
#endif
+#ifndef TARGET_ADDR_SPACE_COMMON_POINTER
+#define TARGET_ADDR_SPACE_COMMON_POINTER default_addr_space_common_pointer
+#endif
+
#ifndef TARGET_ADDR_SPACE_CONVERT
#define TARGET_ADDR_SPACE_CONVERT default_addr_space_convert
#endif
@@ -496,6 +500,7 @@
TARGET_ADDR_SPACE_NUMBER, \
TARGET_ADDR_SPACE_CAN_CONVERT_P, \
TARGET_ADDR_SPACE_NOP_CONVERT_P, \
+ TARGET_ADDR_SPACE_COMMON_POINTER, \
TARGET_ADDR_SPACE_CONVERT, \
TARGET_ADDR_SPACE_VALID_P, \
TARGET_ADDR_SPACE_SECTION_NAME, \
Index: gcc/output.h
===================================================================
--- gcc/output.h (revision 142261)
+++ gcc/output.h (working copy)
@@ -619,7 +619,7 @@ extern void default_internal_label (FILE
extern void default_file_start (void);
extern void file_end_indicate_exec_stack (void);
extern bool default_valid_pointer_mode (enum machine_mode);
-extern enum machine_mode default_addr_space_pointer_mode (int);
+extern enum machine_mode default_addr_space_pointer_mode (addr_space_t);
extern void default_elf_asm_output_external (FILE *file, tree,
const char *);
Index: gcc/config/spu/spu.opt
===================================================================
--- gcc/config/spu/spu.opt (revision 142287)
+++ gcc/config/spu/spu.opt (working copy)
@@ -92,9 +92,9 @@ Target Report RejectNegative Var(spu_ea_
Access variables in 64-bit PPU objects
mno-local-ea-conversion
-Target Report RejectNegative Mask(NO_EA_LOCAL_CONVERSION)
+Target Report RejectNegative Mask(NO_LOCAL_EA_CONVERSION)
Don't allow pointers in the __ea address space to be converted to local pointers.
mlocal-ea-conversion
-Target Report RejectNegative InverseMask(NO_EA_LOCAL_CONVERSION)
+Target Report RejectNegative InverseMask(NO_LOCAL_EA_CONVERSION)
Allow pointers in the __ea address space to be converted to local pointers (default).
Index: gcc/config/spu/spu.c
===================================================================
--- gcc/config/spu/spu.c (revision 142287)
+++ gcc/config/spu/spu.c (working copy)
@@ -210,7 +210,7 @@ tree spu_builtin_types[SPU_BTI_MAX];
/* TARGET overrides. */
-static enum machine_mode spu_ea_pointer_mode (int);
+static enum machine_mode spu_ea_pointer_mode (addr_space_t);
#undef TARGET_ADDR_SPACE_POINTER_MODE
#define TARGET_ADDR_SPACE_POINTER_MODE spu_ea_pointer_mode
@@ -230,6 +230,11 @@ static bool spu_addr_space_nop_convert_p
#undef TARGET_ADDR_SPACE_NOP_CONVERT_P
#define TARGET_ADDR_SPACE_NOP_CONVERT_P spu_addr_space_nop_convert_p
+static addr_space_t spu_addr_space_common_pointer (addr_space_t,
+ addr_space_t);
+#undef TARGET_ADDR_SPACE_COMMON_POINTER
+#define TARGET_ADDR_SPACE_COMMON_POINTER spu_addr_space_common_pointer
+
static rtx spu_addr_space_convert (rtx, enum machine_mode, addr_space_t,
addr_space_t);
#undef TARGET_ADDR_SPACE_CONVERT
@@ -6468,7 +6473,7 @@ spu_vector_alignment_reachable (const_tr
/* Return the appropriate mode for a named address pointer. */
static enum machine_mode
-spu_ea_pointer_mode (int addrspace)
+spu_ea_pointer_mode (addr_space_t addrspace)
{
switch (addrspace)
{
@@ -6635,7 +6640,7 @@ spu_addr_space_can_convert_p (addr_space
gcc_assert (from == ADDR_SPACE_GENERIC || from == ADDR_SPACE_EA);
gcc_assert (to == ADDR_SPACE_GENERIC || to == ADDR_SPACE_EA);
- if (TARGET_NO_EA_LOCAL_CONVERSION
+ if (TARGET_NO_LOCAL_EA_CONVERSION
&& from == ADDR_SPACE_EA
&& to == ADDR_SPACE_GENERIC)
return false;
@@ -6654,6 +6659,19 @@ spu_addr_space_nop_convert_p (addr_space
return (to == from);
}
+/* Determine what named address space pointer to use between pointers to two
+ different address spaces. */
+
+static addr_space_t
+spu_addr_space_common_pointer (addr_space_t as1,
+ addr_space_t as2)
+{
+ gcc_assert (as1 == ADDR_SPACE_GENERIC || as1 == ADDR_SPACE_EA);
+ gcc_assert (as2 == ADDR_SPACE_GENERIC || as2 == ADDR_SPACE_EA);
+
+ return (as1 == as2) ? as1 : ADDR_SPACE_EA;
+}
+
/* Convert from one address space to another. */
static rtx
spu_addr_space_convert (rtx op,
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com