From 1875cc885952eed1ba9d7a7a12883d2f230573fe Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Fri, 27 Aug 1993 10:15:28 -0700 Subject: [PATCH] (print_operand_address): When TARGET_MINIMAL_TOC, use r30 instead of r2 for TOC references. (print_operand_address): When TARGET_MINIMAL_TOC, use r30 instead of r2 for TOC references. (output_prologue): If TARGET_MINIMAL_TOC, and the constant pool is needed, then setup r30. (output_toc): When TARGET_MINIMAL_TOC, use .long instead of .tc. From-SVN: r5218 --- gcc/config/rs6000/rs6000.c | 46 ++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 6295b1003ce..f4e0ed80e72 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1171,7 +1171,12 @@ print_operand_address (file, x) else if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == CONST) { output_addr_const (file, x); - fprintf (file, "(2)"); + /* When TARGET_MINIMAL_TOC, use the indirected toc table pointer instead + of the toc pointer. */ + if (TARGET_MINIMAL_TOC) + fprintf (file, "(30)"); + else + fprintf (file, "(2)"); } else if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 1)) == REG) { @@ -1372,6 +1377,11 @@ output_prolog (file, size) /* Set frame pointer, if needed. */ if (frame_pointer_needed) fprintf (file, "\toril 31,1,0\n"); + + /* If TARGET_MINIMAL_TOC, and the constant pool is needed, then load the + TOC_TABLE address into register 30. */ + if (TARGET_MINIMAL_TOC && get_pool_size () != 0) + fprintf (file, "\tl 30,LCTOC..0(2)\n"); } /* Write function epilogue. */ @@ -1643,9 +1653,13 @@ output_toc (file, x, labelno) && BITS_PER_WORD == HOST_BITS_PER_INT && TARGET_FP_IN_TOC) { - fprintf (file, "\t.tc FD_%x_%x[TC],%d,%d\n", - CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x), - CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x)); + if (TARGET_MINIMAL_TOC) + fprintf (file, "\t.long %d\n\t.long %d\n", + CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x)); + else + fprintf (file, "\t.tc FD_%x_%x[TC],%d,%d\n", + CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x), + CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x)); return; } else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode @@ -1656,7 +1670,10 @@ output_toc (file, x, labelno) if (val == 0 || GET_CODE (val) != CONST_INT) abort (); - fprintf (file, "\t.tc FS_%x[TC],%d\n", INTVAL (val), INTVAL (val)); + if (TARGET_MINIMAL_TOC) + fprintf (file, "\t.long %d\n", INTVAL (val)); + else + fprintf (file, "\t.tc FS_%x[TC],%d\n", INTVAL (val), INTVAL (val)); return; } @@ -1675,15 +1692,20 @@ output_toc (file, x, labelno) else abort (); - fprintf (file, "\t.tc "); - RS6000_OUTPUT_BASENAME (file, name); + if (TARGET_MINIMAL_TOC) + fprintf (file, "\t.long "); + else + { + fprintf (file, "\t.tc "); + RS6000_OUTPUT_BASENAME (file, name); - if (offset < 0) - fprintf (file, ".N%d", - offset); - else if (offset) - fprintf (file, ".P%d", offset); + if (offset < 0) + fprintf (file, ".N%d", - offset); + else if (offset) + fprintf (file, ".P%d", offset); - fprintf (file, "[TC],"); + fprintf (file, "[TC],"); + } output_addr_const (file, x); fprintf (file, "\n"); } -- 2.30.2