aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2007-05-09 11:57:49 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2007-05-09 11:57:49 +0000
commit520c62adcda2977418be8c7163d413549f5e7e3d (patch)
tree72aeffb5e3021c4efe73693261c02bf5e915025f /gcc
parent0416068158e46ca20a07a30f4e19c43715f103ea (diff)
downloadgcc-520c62adcda2977418be8c7163d413549f5e7e3d.zip
gcc-520c62adcda2977418be8c7163d413549f5e7e3d.tar.gz
gcc-520c62adcda2977418be8c7163d413549f5e7e3d.tar.bz2
bfin.h (LOCAL_ALIGNMENT): Define.
* config/bfin/bfin.h (LOCAL_ALIGNMENT): Define. * config/bfin/bfin.c (bfin_local_alignment): New function. * config/bfin/bfin-protos.h (bfin_local_alignment): Declare it. From-SVN: r124570
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/bfin/bfin-protos.h1
-rw-r--r--gcc/config/bfin/bfin.c18
-rw-r--r--gcc/config/bfin/bfin.h12
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4c7ba63..a5b1469 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-08 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/bfin.h (LOCAL_ALIGNMENT): Define.
+ * config/bfin/bfin.c (bfin_local_alignment): New function.
+ * config/bfin/bfin-protos.h (bfin_local_alignment): Declare it.
+
2007-05-08 Chao-ying Fu <fu@mips.com>
* doc/md.texi (msub@var{m}@var{n}4, usub@var{m}@var{n}4): Document.
diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h
index 9495530..525ecd32 100644
--- a/gcc/config/bfin/bfin-protos.h
+++ b/gcc/config/bfin/bfin-protos.h
@@ -86,6 +86,7 @@ extern void override_options (void);
extern void asm_conditional_branch (rtx, rtx *, int, int);
extern rtx bfin_gen_compare (rtx, Mmode);
+extern int bfin_local_alignment (tree, int);
extern int bfin_return_in_memory (tree);
extern void initialize_trampoline (rtx, rtx, rtx);
extern bool bfin_legitimate_address_p (Mmode, rtx, int);
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index a91e488..94849ce 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3045,6 +3045,24 @@ bfin_expand_movmem (rtx dst, rtx src, rtx count_exp, rtx align_exp)
return false;
}
+/* Compute the alignment for a local variable.
+ TYPE is the data type, and ALIGN is the alignment that
+ the object would ordinarily have. The value of this macro is used
+ instead of that alignment to align the object. */
+
+int
+bfin_local_alignment (tree type, int align)
+{
+ /* Increasing alignment for (relatively) big types allows the builtin
+ memcpy can use 32 bit loads/stores. */
+ if (TYPE_SIZE (type)
+ && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
+ && (TREE_INT_CST_LOW (TYPE_SIZE (type)) > 8
+ || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 32)
+ return 32;
+ return align;
+}
+
/* Implement TARGET_SCHED_ISSUE_RATE. */
static int
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index c2e75b2..5a779da 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -227,6 +227,18 @@ extern const char *bfin_library_id_string;
/*#define DATA_ALIGNMENT(TYPE, BASIC-ALIGN) for arrays.. */
+/* If defined, a C expression to compute the alignment for a local
+ variable. TYPE is the data type, and ALIGN is the alignment that
+ the object would ordinarily have. The value of this macro is used
+ instead of that alignment to align the object.
+
+ If this macro is not defined, then ALIGN is used.
+
+ One use of this macro is to increase alignment of medium-size
+ data to make it all fit in fewer cache lines. */
+
+#define LOCAL_ALIGNMENT(TYPE, ALIGN) bfin_local_alignment ((TYPE), (ALIGN))
+
/* Make strings word-aligned so strcpy from constants will be faster. */
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
(TREE_CODE (EXP) == STRING_CST \