[LLVMdev] llvm-gcc and mips

HyperQuantum hyperquantum at gmail.com
Fri Mar 7 12:10:18 PST 2008


On Fri, Mar 7, 2008 at 8:28 PM, Bruno Cardoso Lopes
<bruno.cardoso at gmail.com> wrote:

>  When using mips-unknown-linux-gnu as a cross-compiler, the llvm Mips
>  backend is called by cc1 and with that you get llvm bytecode defined
>  relative to the Mips ABI.

That was my intention. The PSP has a 32-bit MIPS (derived) CPU. What I
don't know is if that triple is the right one to pick.
I looked through the patch that turns gcc into psp-gcc and it defines
a special triple called simply "psp":

diff -burN gcc-4.1.0/config.sub gcc-psp/config.sub
--- gcc-4.1.0/config.sub	2005-12-16 12:57:40.000000000 +0000
+++ gcc-psp/config.sub	2006-05-07 13:27:40.000000000 +0100
@@ -264,6 +264,7 @@
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
+	| mipsallegrex | mipsallegrexel \
 	| mn10200 | mn10300 \
 	| mt \
 	| msp430 \
@@ -346,6 +347,7 @@
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
+	| mipsallegrex-* | mipsallegrexel-* \
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
@@ -689,6 +691,10 @@
 		basic_machine=m68k-atari
 		os=-mint
 		;;
+	psp)
+		basic_machine=mipsallegrexel-psp
+		os=-elf
+		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;

I did not see any changes in the rest of the diff that did something
to the ABI; as far as I understand it it's only adding some extra
instructions. So I assume that the PSP uses a standard MIPS ABI. And
yet something is still wrong, even more than with a native
"i686-pc-linux-gnu" llvm-gcc.

>  This can be messing up somehow your
>  generated C code.

Supposed that you knew my approach was intentional (correct me if I'm
wrong), what problem did you see here?


Regards,
Kevin André




More information about the llvm-dev mailing list