This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[bfin] Improve legitimize_pic_address


With the patch I posted on gcc mailing list:

http://gcc.gnu.org/ml/gcc/2007-09/msg00421.html

bfin port gcc configures libstdc++ OK. But it failed to build -msep-data libstdc++:

libtool: compile:  /home/jie/blackfin-sources/build43/gcc_build-4.3/./gcc/xgcc -shared-libgcc -B/home/jie/blackfin-sources/build43/gcc_build-4.3/./gcc -nostdinc++ -L/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libstdc++-v3/src -L/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libstdc++-v3/src/.libs -nostdinc -B/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/newlib/ -isystem /home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/newlib/targ-include -isystem /home/jie/blackfin-sources/toolchain/trunk/gcc-4.3/newlib/libc/include -B/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libgloss/bfin -L/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libgloss/libnosys -L/home/jie/blackfin-sources/toolchain/trunk/gcc-4.3/libgloss/bfin -B/home/jie/installs/bfin-43/bfin-elf/bin/ -B/home/jie/installs/bfin-43/bfin-elf/lib/ -isystem /home/jie/installs/bfin-43/bfin-elf/include -isy
stem /home/jie/installs/bfin-43/bfin-elf/sys-include -msep-data -I/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libstdc++-v3/include/bfin-elf -I/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libstdc++-v3/include -I/home/jie/blackfin-sources/toolchain/trunk/gcc-4.3/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -O2 -msep-data -c /home/jie/blackfin-sources/toolchain/trunk/gcc-4.3/libstdc++-v3/src/complex_io.cc -o complex_io.o
/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libstdc++-v3/include/complex: In function 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::complex<_Tp>&) [with _Tp = double, _CharT = char, _Traits = std::char_traits<char>]':
/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libstdc++-v3/include/complex:528: internal compiler error: in legitimize_pic_address, at config/bfin/bfin.c:325
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[8]: *** [complex_io.lo] Error 1
make[8]: Leaving directory `/home/jie/blackfin-sources/build43/gcc_build-4.3/bfin-elf/msep-data/libstdc++-v3/src'


legitimize_pic_address tried to legitimize


(const:SI (plus:SI (symbol_ref:SI ("_ZNSs4_Rep20_S_empty_rep_storageE"))
       (const_int 12)))

It put the SYMBOL_REF in (reg:SI 9 P1). But it failed to legitmize (const_int 12), since reload_in_progress == 1 and it could not force it in a register.

Since Blackfin has instructions like

DPREGS += IMM7

we need not force such immediates into a register. This patch does that.

Is it OK?


Jie
	* config/bfin/bfin.c (legitimize_pic_address): Don't force
	CONST_INT into a reg if it fits add immediate instruction.

Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc.orig/config/bfin/bfin.c	2007-09-20 10:04:14.000000000 +0800
+++ gcc/config/bfin/bfin.c	2007-09-20 12:00:13.000000000 +0800
@@ -320,7 +320,9 @@
 				     base == reg ? NULL_RTX : reg,
 				     picreg);
 
-      if (GET_CODE (addr) == CONST_INT)
+      if (GET_CODE (addr) == CONST_INT
+	  && !(DREG_P (base) && CONST_7BIT_IMM_P (INTVAL (addr)))
+	  && !(PREG_P (base) && CONST_7BIT_IMM_P (INTVAL (addr))))
 	{
 	  gcc_assert (! reload_in_progress && ! reload_completed);
 	  addr = force_reg (Pmode, addr);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]