diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7983e984915..a3b15b4161d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2008-10-15 Richard Sandiford + + * config/mn10300/mn10300.h (OUTPUT_ADDR_CONST_EXTRA): Handle + UNSPEC_GOTSYM_OFFs. + * config/mn10300/mn10300.c (legitimate_pic_operand_p): Return true + for UNSPEC_GOTSYM_OFFs. + * config/mn10300/mn10300.md (UNSPEC_GOTSYM_OFF): New unspec. + (add_GOT_to_pic_reg): Use it. + * config/mn10300/constraints.md (S): Allow UNSPEC_GOTSYM_OFF. + 2008-10-15 Jan Sjodin Harsha Jagasia diff --git a/gcc/config/mn10300/constraints.md b/gcc/config/mn10300/constraints.md index 53f128750c7..8dbf63a75ba 100644 --- a/gcc/config/mn10300/constraints.md +++ b/gcc/config/mn10300/constraints.md @@ -68,7 +68,8 @@ (if_then_else (match_test "flag_pic") (and (match_test "GET_CODE (op) == UNSPEC") (ior (match_test "XINT (op, 1) == UNSPEC_PLT") - (match_test "XINT (op, 1) == UNSPEC_PIC"))) + (match_test "XINT (op, 1) == UNSPEC_PIC") + (match_test "XINT (op, 1) == UNSPEC_GOTSYM_OFF"))) (match_test "GET_CODE (op) == SYMBOL_REF"))) ;; Integer constraints diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index f89e0751c4c..eed82997244 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -1869,7 +1869,8 @@ legitimate_pic_operand_p (rtx x) && (XINT (x, 1) == UNSPEC_PIC || XINT (x, 1) == UNSPEC_GOT || XINT (x, 1) == UNSPEC_GOTOFF - || XINT (x, 1) == UNSPEC_PLT)) + || XINT (x, 1) == UNSPEC_PLT + || XINT (x, 1) == UNSPEC_GOTSYM_OFF)) return 1; fmt = GET_RTX_FORMAT (GET_CODE (x)); diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index c1c80579427..d83eedfb08a 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -738,7 +738,7 @@ while (0) constants. Used for PIC-specific UNSPECs. */ #define OUTPUT_ADDR_CONST_EXTRA(STREAM, X, FAIL) \ do \ - if (GET_CODE (X) == UNSPEC && XVECLEN ((X), 0) == 1) \ + if (GET_CODE (X) == UNSPEC) \ { \ switch (XINT ((X), 1)) \ { \ @@ -762,6 +762,12 @@ while (0) output_addr_const ((STREAM), XVECEXP ((X), 0, 0)); \ fputs ("@PLT", (STREAM)); \ break; \ + case UNSPEC_GOTSYM_OFF: \ + assemble_name (STREAM, GOT_SYMBOL_NAME); \ + fputs ("-(", STREAM); \ + output_addr_const (STREAM, XVECEXP (X, 0, 0)); \ + fputs ("-.)", STREAM); \ + break; \ default: \ goto FAIL; \ } \ diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md index 8fbbdc87df5..38aa37645ac 100644 --- a/gcc/config/mn10300/mn10300.md +++ b/gcc/config/mn10300/mn10300.md @@ -45,6 +45,7 @@ (UNSPEC_GOT 2) (UNSPEC_GOTOFF 3) (UNSPEC_PLT 4) + (UNSPEC_GOTSYM_OFF 5) ]) (include "predicates.md") @@ -2619,18 +2620,9 @@ [(set (reg:SI PIC_REG) (plus:SI (reg:SI PIC_REG) - (const - (unspec [(minus:SI - (match_dup 1) - (const (minus:SI - (const (match_operand:SI 0 "" "")) - (pc)))) - ] UNSPEC_PIC))))] - "" - " -{ - operands[1] = gen_rtx_SYMBOL_REF (VOIDmode, GOT_SYMBOL_NAME); -}") + (const:SI + (unspec:SI [(match_operand:SI 0 "" "")] UNSPEC_GOTSYM_OFF))))] + "") (define_expand "symGOT2reg" [(match_operand:SI 0 "" "")