+2011-01-18 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ PR tree-optimization/47179
+ * config/spu/spu.c (spu_ref_may_alias_errno): New function.
+ (TARGET_REF_MAY_ALIAS_ERRNO): Define.
+
2011-01-18 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/47216
static rtx spu_expand_load (rtx, rtx, rtx, int);
static void spu_trampoline_init (rtx, tree, rtx);
static void spu_conditional_register_usage (void);
+static bool spu_ref_may_alias_errno (ao_ref *);
/* Which instruction set architecture to use. */
int spu_arch;
#undef TARGET_CONDITIONAL_REGISTER_USAGE
#define TARGET_CONDITIONAL_REGISTER_USAGE spu_conditional_register_usage
+#undef TARGET_REF_MAY_ALIAS_ERRNO
+#define TARGET_REF_MAY_ALIAS_ERRNO spu_ref_may_alias_errno
+
struct gcc_target targetm = TARGET_INITIALIZER;
static void
fprintf (file, "brsl $75, _mcount\n");
}
+/* Implement targetm.ref_may_alias_errno. */
+static bool
+spu_ref_may_alias_errno (ao_ref *ref)
+{
+ tree base = ao_ref_base (ref);
+
+ /* With SPU newlib, errno is defined as something like
+ _impure_data._errno
+ The default implementation of this target macro does not
+ recognize such expressions, so special-code for it here. */
+
+ if (TREE_CODE (base) == VAR_DECL
+ && !TREE_STATIC (base)
+ && DECL_EXTERNAL (base)
+ && TREE_CODE (TREE_TYPE (base)) == RECORD_TYPE
+ && strcmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (base)),
+ "_impure_data") == 0
+ /* _errno is the first member of _impure_data. */
+ && ref->offset == 0)
+ return true;
+
+ return default_ref_may_alias_errno (ref);
+}
+
#include "gt-spu.h"