[cfe-dev] [LLVMdev] [MIPS] How can I add a constraint to LLVM/Clang for MIPS BE?

Jia Liu proljc at gmail.com
Sun Mar 3 18:02:09 PST 2013


Hi Jack,

On Sat, Mar 2, 2013 at 8:15 AM, Jack Carter <Jack.Carter at imgtec.com> wrote:
> Jia,
>
> I made what I believe to be the correct changes and rebuilt clang and llc. Are the results what you expected? I so I will prepare the patches for commitment.
>
> Jack
>
> clang ../mips_R_JiaLiu.c -o mips_R_JiaLiu.ll -emit-llvm -O3 -S -target mipsel-unknown-linux -std=gnu89
> llc mips_R_JiaLiu.ll -o mips_R_JiaLiu.o -mcpu=mips32r2 -march=mipsel -filetype=obj
> mips-linux-gnu-gcc -mips32r2 -O3 -EL -fPIC -o mips_R_JiaLiu.exe mips_R_JiaLiu.o
>

I use your way to compile test case:
llvm-install/bin/clang constraints.c -o constraints.ll -emit-llvm -O3
-S -target mipsel-unknown-linux -std=gnu89 --sysroot
/Users/jia/project/Cross-SDK/sdk/mipsel-gnu-rootfs
llvm-install/bin/llc constraints.ll -o constraints.llc.s
-mcpu=mips32r2 -march=mipsel -filetype=asm
llvm-install/bin/llc constraints.ll -o constraints.o -mcpu=mips32r2
-march=mipsel -filetype=obj
mipsel-unknown-linux-gnu-gcc -mips32r2 -O3 -EL -fPIC -static -o
constraints.exe constraints.o

the inline-asm is:
	#APP
	lw $5, 0($1)
	#NO_APP

	#APP
	lw $5, 0($1)
	#NO_APP

	#APP
	lwl $5, 1 + 0($1)
	lwr $5, 2 + 0($1)	
	#NO_APP

It use different registers, but $1, that is $AT, cann't be used, it is
reserved for $AS using.
any ideas?

> inline_asm: run *.exe
> out is 4
> out is 10
> out is ccddffbb
> inline_asm:
>

Regards,
Jia



More information about the cfe-dev mailing list