[LLVMdev] [MIPS] How can I add a constraint to LLVM/Clang for MIPS BE?
Reed Kotler
rkotler at mips.com
Mon Mar 4 16:10:25 PST 2013
Maybe try:
.set noat
AT is needed to create certain instructions from pseudo instructions, so
you have to be careful how you use this. Some instructions that you can
use in Mips assembler are in fact pseudos.
While AT is not available to it (.set noat), the assembler can not
assemble certain pseudos for you.
On 03/03/2013 06:02 PM, Jia Liu wrote:
> Hi Jack,
>
> On Sat, Mar 2, 2013 at 8:15 AM, Jack Carter <Jack.Carter-1AXoQHu6uovQT0dZR+AlfA at public.gmane.org> 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 llvm-dev
mailing list