Sandeep Gupta
2010-Oct-04 22:00 UTC
[LLVMdev] how to handle inline asm code when converting c++ to C
Hi, I am using llvm to convert some C++ code to C. However the C++ code has couple of lines of assembly that is supposed to be inlined. I am using __asm__ directive. However the resulting C code has syntax errors: main.c: In function ‘_Z23atomic_exchange_and_addPii’: main.c:397: error: expected ‘:’ or ‘)’ before string constant main.c: In function ‘_Z16atomic_incrementPi’: main.c:421: error: expected ‘:’ or ‘)’ before string constant For reference here is the line in the code that is causing the above errors: __asm__ volatile ("lock\n\txadd %1, %0" :"=m"(llvm_cbe_asmtmp)"=r"(llvm_cbe_tmp__5) :"m"(*(llvm_cbe_tmp__6))"1"(llvm_cbe_tmp__6)"cc""memory"); I am new to the llvm so if this is not the right forum do let me know. Thanks. Sandeep -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101004/e3df8a4c/attachment.html>
Duncan Sands
2010-Oct-05 07:11 UTC
[LLVMdev] how to handle inline asm code when converting c++ to C
Hi Sandeep,> I am using llvm to convert some C++ code to C. However the C++ code has couple > of lines of assembly that is supposed to be inlined. I am using __asm__ directive. > However the resulting C code has syntax errors:this looks like PR802 (see http://llvm.org/bugs/show_bug.cgi?id=802). Ciao, Duncan. PS: The C backend is deprecated and unmaintained.
Reasonably Related Threads
- [LLVMdev] all LLVM Instructions that may write to memory -- other than StoreInst?
- [LLVMdev] all LLVM Instructions that may write to memory -- other than StoreInst?
- [LLVMdev] all LLVM Instructions that may write to memory -- other than StoreInst?
- [LLVMdev] FP Stack overflow with inline asm
- [LLVMdev] Bug in ARM Thumb inline asm?