From: Chung-Lin Tang Date: Sun, 5 Jul 2015 21:49:08 +0000 (+0000) Subject: nios2-protos.h (nios2_symbol_ref_in_small_data_p): Delete extern declaration. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7dcc7195959693f57a3df3ccc92854566b96b590;p=gcc.git nios2-protos.h (nios2_symbol_ref_in_small_data_p): Delete extern declaration. 2015-07-05 Chung-Lin Tang Sandra Loosemore 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 From-SVN: r225437 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ef5ef1d445..0d6337c2a23 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2015-07-05 Chung-Lin Tang + Sandra Loosemore + + * 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 * doc/fragments.texi (Target Fragment): Convert debian.org diff --git a/gcc/config/nios2/constraints.md b/gcc/config/nios2/constraints.md index 735f892d524..b67e87d3b3c 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 2855c92b2f6..52985a9d06c 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 fd035fb59aa..51f7aa2defb 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 2b29e1a6759..2eb4fdc22a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-05 Chung-Lin Tang + Sandra Loosemore + + * gcc.target/nios2/gprel-offset.c: New test. + 2015-07-04 Steven G. Kargl 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 00000000000..05186c66adb --- /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 } } */