Hi everyone, inline asm code is like below: void test(unsigned short a) { asm("myinstr my16bitreg, %0"::"r"(a)); } I want it generate instruction "myinstr my16bitreg, r15" I execute llc test.bc -march = msp430 -o test.s then it reports "LLVM ERROR: Couldn't allocate input reg for constraint 'r' !" What's the reason? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091218/c43046c7/attachment.html>
Anton Korobeynikov
2009-Dec-18 10:20 UTC
[LLVMdev] problem when use inline asm for msp430 target
Hello> inline asm code is like below: > > void test(unsigned short a) { > asm("myinstr my16bitreg, %0"::"r"(a)); > } > I want it generate instruction "myinstr my16bitreg, r15" > > I execute > llc test.bc -march = msp430 -o test.s > then it reports > "LLVM ERROR: Couldn't allocate input reg for constraint 'r' !"Works for me. Make sure you're using latest LLVM trunk. inline asm for msp430 were not available with 2,6 release iirc. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Mine is LLVM2.6's release version, so it doesn't work Thank you! 2009/12/18 Anton Korobeynikov <anton at korobeynikov.info>> Hello > > > inline asm code is like below: > > > > void test(unsigned short a) { > > asm("myinstr my16bitreg, %0"::"r"(a)); > > } > > I want it generate instruction "myinstr my16bitreg, r15" > > > > I execute > > llc test.bc -march = msp430 -o test.s > > then it reports > > "LLVM ERROR: Couldn't allocate input reg for constraint 'r' !" > Works for me. Make sure you're using latest LLVM trunk. inline asm for > msp430 were not available with 2,6 release iirc. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091218/f7506414/attachment.html>
Hi Anton, Need i write additial c/c++/td code for my target to support inline asm? Regrads 2009/12/18 Anton Korobeynikov <anton at korobeynikov.info>> Hello > > > inline asm code is like below: > > > > void test(unsigned short a) { > > asm("myinstr my16bitreg, %0"::"r"(a)); > > } > > I want it generate instruction "myinstr my16bitreg, r15" > > > > I execute > > llc test.bc -march = msp430 -o test.s > > then it reports > > "LLVM ERROR: Couldn't allocate input reg for constraint 'r' !" > Works for me. Make sure you're using latest LLVM trunk. inline asm for > msp430 were not available with 2,6 release iirc. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091218/095032c1/attachment.html>