aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorChung-Lin Tang <cltang@codesourcery.com>2015-07-05 21:49:08 +0000
committerSandra Loosemore <sandra@gcc.gnu.org>2015-07-05 17:49:08 -0400
commit7dcc7195959693f57a3df3ccc92854566b96b590 (patch)
treeed87521b0f371de05b482aab31fb3b60a63fc020 /gcc
parent291e91daa73361a1f4a426a879f89c1ea6cf0e9f (diff)
downloadgcc-7dcc7195959693f57a3df3ccc92854566b96b590.zip
gcc-7dcc7195959693f57a3df3ccc92854566b96b590.tar.gz
gcc-7dcc7195959693f57a3df3ccc92854566b96b590.tar.bz2
nios2-protos.h (nios2_symbol_ref_in_small_data_p): Delete extern declaration.
2015-07-05 Chung-Lin Tang <cltang@codesourcery.com> Sandra Loosemore <sandra@codesourcery.com> gcc/ * config/nios2/nios2-protos.h (nios2_symbol_ref_in_small_data_p): Delete extern declaration. (gprel_constant_p): Add extern declaration. * config/nios2/constraints.md ("S"): Use gprel_constant_p instead of nios2_symbol_ref_in_small_data_p. * config/nios2/nios2.c (nios2_legitimate_address_p): Likewise. (nios2_symbol_ref_in_small_data_p): Make static. (gprel_constant_p): Make non-static. gcc/testsuite/ * gcc.target/nios2/gprel-offset.c: New test. Co-Authored-By: Sandra Loosemore <sandra@codesourcery.com> From-SVN: r225437
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config/nios2/constraints.md3
-rw-r--r--gcc/config/nios2/nios2-protos.h2
-rw-r--r--gcc/config/nios2/nios2.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/nios2/gprel-offset.c20
6 files changed, 45 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6ef5ef1..0d6337c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2015-07-05 Chung-Lin Tang <cltang@codesourcery.com>
+ Sandra Loosemore <sandra@codesourcery.com>
+
+ * config/nios2/nios2-protos.h (nios2_symbol_ref_in_small_data_p):
+ Delete extern declaration.
+ (gprel_constant_p): Add extern declaration.
+ * config/nios2/constraints.md ("S"): Use gprel_constant_p
+ instead of nios2_symbol_ref_in_small_data_p.
+ * config/nios2/nios2.c (nios2_legitimate_address_p): Likewise.
+ (nios2_symbol_ref_in_small_data_p): Make static.
+ (gprel_constant_p): Make non-static.
+
2015-07-05 Gerald Pfeifer <gerald@pfeifer.com>
* doc/fragments.texi (Target Fragment): Convert debian.org
diff --git a/gcc/config/nios2/constraints.md b/gcc/config/nios2/constraints.md
index 735f892..b67e87d 100644
--- a/gcc/config/nios2/constraints.md
+++ b/gcc/config/nios2/constraints.md
@@ -84,8 +84,7 @@
(define_constraint "S"
"An immediate stored in small data, accessible by GP."
- (and (match_code "symbol_ref")
- (match_test "nios2_symbol_ref_in_small_data_p (op)")))
+ (match_test "gprel_constant_p (op)"))
(define_constraint "T"
"A constant unspec offset representing a relocation."
diff --git a/gcc/config/nios2/nios2-protos.h b/gcc/config/nios2/nios2-protos.h
index 2855c92..52985a9 100644
--- a/gcc/config/nios2/nios2-protos.h
+++ b/gcc/config/nios2/nios2-protos.h
@@ -44,7 +44,7 @@ extern bool nios2_fpu_insn_enabled (enum n2fpu_code);
extern const char * nios2_fpu_insn_asm (enum n2fpu_code);
extern bool nios2_legitimate_pic_operand_p (rtx);
-extern bool nios2_symbol_ref_in_small_data_p (rtx);
+extern bool gprel_constant_p (rtx);
extern bool nios2_regno_ok_for_base_p (int, bool);
extern bool nios2_unspec_reloc_p (rtx);
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index fd035fb..51f7aa2 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -1614,14 +1614,15 @@ nios2_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED,
case SYMBOL_REF:
if (SYMBOL_REF_TLS_MODEL (operand))
return false;
-
- if (nios2_symbol_ref_in_small_data_p (operand))
+
+ /* Else, fall through. */
+ case CONST:
+ if (gprel_constant_p (operand))
return true;
/* Else, fall through. */
case LABEL_REF:
case CONST_INT:
- case CONST:
case CONST_DOUBLE:
return false;
@@ -1688,7 +1689,7 @@ nios2_in_small_data_p (const_tree exp)
/* Return true if symbol is in small data section. */
-bool
+static bool
nios2_symbol_ref_in_small_data_p (rtx sym)
{
tree decl;
@@ -2110,7 +2111,7 @@ nios2_print_operand (FILE *file, rtx op, int letter)
}
/* Return true if this is a GP-relative accessible reference. */
-static bool
+bool
gprel_constant_p (rtx op)
{
if (GET_CODE (op) == SYMBOL_REF
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2b29e1a..2eb4fdc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-05 Chung-Lin Tang <cltang@codesourcery.com>
+ Sandra Loosemore <sandra@codesourcery.com>
+
+ * gcc.target/nios2/gprel-offset.c: New test.
+
2015-07-04 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66725
diff --git a/gcc/testsuite/gcc.target/nios2/gprel-offset.c b/gcc/testsuite/gcc.target/nios2/gprel-offset.c
new file mode 100644
index 0000000..05186c6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nios2/gprel-offset.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+static struct s {
+ int x;
+ char y;
+} s;
+
+void set (char c)
+{
+ s.y = c;
+}
+
+
+char get (void)
+{
+ return s.y;
+}
+
+/* { dg-final { scan-assembler-times "%gprel\\(s\\+4\\)\\(gp\\)" 2 } } */