Leo Chen.
2011-Aug-15 09:18 UTC
[LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg()
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
Eli Friedman
2011-Aug-15 16:42 UTC
[LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg()
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 assemblyI would suggest trying trunk; there have been a lot of improvements recently to the MIPS backend. -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 >
Jim Grosbach
2011-Aug-15 17:52 UTC
[LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg()
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
Possibly Parallel Threads
- [LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg()
- [LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg()
- [LLVMdev] llc with -march=mips failed to compile va_start()/va_end()/va_arg() (RESOLVED)
- calling va_arg functions on win32 seems to require explicit stack alignment?
- [LLVMdev] Is va_arg deprecated?