[LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg() (RESOLVED)
Leo Chen.
leo.q.chen at gmail.com
Tue Aug 16 08:25:02 PDT 2011
Hi,
The problem is resolved.
I try the svn trunk, llc work fine to generate the MIPS assembly.
Also, I try both llvm-gcc and clang, they work fine at my current
project, though I will use clang to instead of llvm-gcc.
Thanks, everyone.
Regards,
Leo
2011/8/16 Akira Hatanaka <ahatanak at gmail.com>:
> You might want to use clang instead of llvm-gcc: I think there are
> still bugs that remain unfixed in llvm-gcc and it is unlikely that
> someone will fix them.
>
> clang -ccc-host-triple mipsel-unknown-linux -ccc-clang-archs mipsel
> -emit-llvm -O3 -S -o hello.ll hello.c
> llc hello.ll -o hello.s
>
> On Mon, Aug 15, 2011 at 10:52 AM, Jim Grosbach <grosbach at apple.com> wrote:
>>
>> On Aug 15, 2011, at 9:42 AM, Eli Friedman wrote:
>>
>>> On Mon, Aug 15, 2011 at 2:18 AM, Leo Chen. <leo.q.chen at gmail.com> wrote:
>>>> Hi,
>>>>
>>>> I am using llc (llvm 2.9) to generate the MIPS assembly
>>>
>>> I would suggest trying trunk; there have been a lot of improvements
>>> recently to the MIPS backend.
>>>
>>
>> I agree. Also, make sure you're using a MIPS targeted llvm-gcc build. It's unclear from your usage example how llvm-gcc was configured. You can't reliably use an x86 llvm-gcc to generate bitcode and pass that to llc targeting a difference arch.
>>
>> -Jim
>>
>>> -Eli
>>>
>>>> but failed
>>>> when compile any codes
>>>> with va_start()/va_end()/va_arg().
>>>>
>>>> Here is the minimal step to reproduce the failure:
>>>> llvm-gcc-4.2 -emit-llvm hello.c -c -o hello.bc
>>>> llc -march=mips hello.bc -o hello.s
>>>>
>>>> llc show this erroe message:
>>>> LLVM ERROR: Cannot select: 0xa1873a0: ch = vaend 0xa187290:1,
>>>> 0xa185ae0, 0xa187318 [ID=38]
>>>> 0xa185ae0: i32 = FrameIndex<1> [ORD=3] [ID=10]
>>>>
>>>> I try the same thing on arch x86/ARM like this, and they just work fine:
>>>> llc hello.bc -o hello.s //x86
>>>> llc -march=arm hello.bc -o hello.s //ARM
>>>>
>>>> Can anyone tell me whether it's a bug so that I could submit the bug
>>>> on Bugzilla?
>>>> And any suggestion about how to fix this problem is appreciated.
>>>>
>>>> ----------- hello.c --------------------------
>>>> #include <stdio.h>
>>>> #include <stdarg.h>
>>>> void print_msg( const char *fmt, ... )
>>>> {
>>>> va_list ap;
>>>> va_start( ap, fmt );
>>>> vprintf( fmt, ap );
>>>> va_end( ap );
>>>> }
>>>> int main()
>>>> {
>>>> print_msg( "hello\n" );
>>>> return 0;
>>>> }
>>>> -----------------------------------------------
>>>>
>>>>
>>>> Regards,
>>>> Leo
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>>
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
More information about the llvm-dev
mailing list