First Last Prev Next    No search results available
Details
: CBE lacks inline asm support
Bug#: 802
: libraries
: Backend: C
Status: NEW
Resolution:
: All
: All
: 1.0
: P2
: normal
: ---

:
: missing-feature
:
: 862
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <clattner@apple.com>
Assigned To: Unassigned LLVM Bugs <unassignedbugs@nondot.org>
:

Attachments
Reduced testcase from the archie-client test (2.10 KB, text/x-csrc)
2008-06-20 04:17, Matthijs Kooijman
Details


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2006-06-07 17:21
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
------- Comment #1 From Chris Lattner 2007-02-19 16:27:04 -------
*** Bug 1212 has been marked as a duplicate of this bug. ***
------- Comment #2 From Chris Lattner 2007-03-25 00:50:39 -------
*** Bug 1254 has been marked as a duplicate of this bug. ***
------- Comment #3 From Chris Lattner 2008-02-26 17:15:17 -------
*** Bug 2102 has been marked as a duplicate of this bug. ***
------- Comment #4 From Matthijs Kooijman 2008-06-20 04:16:44 -------
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’
------- Comment #5 From Matthijs Kooijman 2008-06-20 04:17:18 -------
Created an attachment (id=1759) [details]
Reduced testcase from the archie-client test
------- Comment #6 From Anton Korobeynikov 2008-09-10 13:55:58 -------
*** Bug 2785 has been marked as a duplicate of this bug. ***
------- Comment #7 From Arif Kasim 2008-09-11 10:55:02 -------
Is there any workaround for this issue? Thanks.

-Arif
------- Comment #8 From Anton Korobeynikov 2008-09-11 11:15:09 -------
(In reply to comment #7)
> Is there any workaround for this issue? Thanks.
Yes, surely. Don't use inline asm :)
------- Comment #9 From Anton Korobeynikov 2008-09-29 14:43:37 -------
*** Bug 2839 has been marked as a duplicate of this bug. ***
------- Comment #10 From Tom Janssen 2009-05-20 09:40:43 -------
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

First Last Prev Next    No search results available