problem when use inline asm for msp430 target

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

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.

Mine is LLVM2.6’s release version, so it doesn’t work

Thank you!

2009/12/18 Anton Korobeynikov <anton@korobeynikov.info>

Hi Anton,

Need i write additial c/c++/td code for my target to support inline asm?

Regrads

2009/12/18 Anton Korobeynikov <anton@korobeynikov.info>

Hello

Need i write additial c/c++/td code for my target to support inline asm?

Yes, surely. You need to match all the constraint codes and "lower"
stuff in the backend.