[LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg()

Leo Chen. leo.q.chen at gmail.com
Mon Aug 15 02:18:34 PDT 2011


Hi,

I am using llc (llvm 2.9) to generate the MIPS assembly, 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



More information about the llvm-dev mailing list