The C backend, at least when the C is compiled by GCC, should be able to change LLVM inline asm back into GCC-style inline asm in the cbe.c file. Right now, we just output an unresolved symbol when inline asm is used. -Chris
*** Bug 1212 has been marked as a duplicate of this bug. ***
*** Bug 1254 has been marked as a duplicate of this bug. ***
*** Bug 2102 has been marked as a duplicate of this bug. ***
Since a few days, the MultiSource/Benchmarks/Prolangs-C/archie-client from the test suite is failing, probably due inline ASM being used. I just finished creating a reduced testcase for that, which might be redundant now I read this bug. I'll still attach it, feel free to thrash it if it is not helpful. If this a different issue, I'll open a new report instead. The output of the attached program is as follows: kooijman@eris:~$ llvm-gcc -c test.c -o - -emit-llvm | llc -march=c -f -o test.cbe.c; gcc test.cbe.c test.cbe.c:132: warning: conflicting types for built-in function ‘malloc’ test.cbe.c: In function ‘main’: test.cbe.c:187: error: expected ‘:’ or ‘)’ before string constant test.cbe.c:163: warning: return type of ‘main’ is not ‘int’
Created attachment 1759 [details] Reduced testcase from the archie-client test
*** Bug 2785 has been marked as a duplicate of this bug. ***
Is there any workaround for this issue? Thanks. -Arif
(In reply to comment #7) > Is there any workaround for this issue? Thanks. Yes, surely. Don't use inline asm :)
*** Bug 2839 has been marked as a duplicate of this bug. ***
I use llvm to instrument (C) programs and have bumped into this issue as well. In fact, I had to edit the CBE generated .c file to fix the inline asm and I have traced the failures I encountered back to three separate bugs in lib/Target/CBackend/CBackend.cpp: 1) in the visitInlineAsm function there are three loops for traversing and printing constraints, which should be separated by commas. This fails because the 'IsFirst' boolean, which should make sure a comma is printed before the constraint if it is not the first in the line, is only set to false whenever the boolean is false (never happens). Simple fix is to set it false outside the if-statement... 2) in the same function the clobber constraints (third loop) are not preceded by a ':'. 3) the gccifyAsm function somehow prints some register names with '%%regname' in stead of '$regname' For the project I am working on, I limited to the use LLVM version 2.4 only, so right now I am not able to active develop or bugfix the LLVM tools, and I have checked the latest version of CBackend.cpp, but it did not contain fixes for the bugs. I hope that someone more involved will address it, since it takes up unnecessary time fixing the faults in the resulting files, and I'm sure more people have encountered it. Greetings, Tom
*** Bug 4924 has been marked as a duplicate of this bug. ***
*** Bug 5877 has been marked as a duplicate of this bug. ***
Created attachment 6093 [details] CBE patch Attached patch fixes some of these issues. I sent this to llvm-commits but I guess I should've searched the bug tracker to see if anyone else came across this earlier.
(In reply to comment #13) > Created an attachment (id=6093) [details] > CBE patch > > Attached patch fixes some of these issues. I sent this to llvm-commits but I > guess I should've searched the bug tracker to see if anyone else came across > this earlier. Ping? Would it be possible to commit this?
Could you please add some testcases.
*** Bug 9737 has been marked as a duplicate of this bug. ***
(In reply to comment #15) > Could you please add some testcases. The patch from Jai Menon fixes the case from bug 9737 http://llvm.org/bugs/show_bug.cgi?id=9737 Instead of invalid inline asm __asm__ volatile ("rorw %%8, %w0" :"=r"(llvm_cbe_asmtmp) :"0"(((unsigned short )15))"cc"); patched CBE generates __asm__ volatile ("rorw $8, %w0" :"=r"(llvm_cbe_asmtmp) :"0"(((unsigned short )15)) :"cc"); and result is correct. Checked with llvm trunk r129558.
However, there are still fails with Assertion `I->Codes.size() == 1 && "Too many asm constraint codes to handle"' failed. So patch fixes only the issue specific to inline asm arguments, and to fix the assertion above somebody should implement //TODO: work out platform independent constraints and factor those out // of the per target tables // handle multiple constraint codes
The C backend was removed from svn trunk and is no longer maintained. Closing the bug.