First Last Prev Next    No search results available
Details
: [X86] llc output for functions w/ certain names tickles G...
Bug#: 227
: libraries
: Backend: X86
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P2
: normal
: 1.4

:
: compile-fail
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Unassigned LLVM Bugs <unassignedbugs@nondot.org>
:

Attachments


Note

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

Related actions


Description:   Opened: 2004-02-09 16:55
The X86 backend produces an uncompilable .s file for the following function:

---
void %byte() {
  ret void
}
---

The problem is that we currently use .intel_syntax, and gas seems to be broken
in this case.

-Chris
------- Comment #1 From Brian R. Gaeke 2004-02-11 11:16:48 -------
So shall I start hacking on a X86ATTSyntaxPrinter? it seems like the most
bulletproof way to go. We don't need to ditch the existing intel printer; we
might want to use it for debug output or for future work on systems with real
intel-syntax compatible assemblers.
------- Comment #2 From Chris Lattner 2004-02-11 11:19:21 -------
Unfortunately I think that's the best way to go.  Would it be possible to just
parameterize the current asmprinter, like we do for %'s on registers?

-Chris
------- Comment #3 From Brian R. Gaeke 2004-02-23 16:34:23 -------
I was thinking about this, and it occurred to me that we'll need a separate
table of instruction names -- many instructions have different names in AT&T
syntax than they do in Intel syntax.  I don't know if there is a good, non-hacky
way to do this.  We can get pretty far using the "mode suffix" whereby "DWORD
PTR" becomes an "l" at the end of the opcode name, but I distinctly recall
coming across problems in my initial work on the X86 LLC that suggested to me
that there were lots of special cases.
------- Comment #4 From Chris Lattner 2004-02-23 16:35:40 -------
We could easily add the 'at&t' name of each instruction to the X86InstrInfo.td
file, but this is annoying and gross.  :(

-Chris
------- Comment #5 From Brian R. Gaeke 2004-02-25 19:01:20 -------
You could say it comes down to which kind of annoying and gross do we want to
be -- if we expect the 
AT&T syntax to be the special case, Intel syntax can be a hack; if we expect
the Intel syntax to be the 
special case, AT&T syntax can be a hack.

Perhaps we should use AT&T-syntax names in the general case, on the assumption
that most of our 
users will be on Unix or Linux, and have the Intel printer employ a separate
table on the side. I don't 
know  if there are other cases where we are going to need to support multiple
assembly formats, but I 
doubt it, and so I don't necessarily think that we should look for a general
solution to this problem.
------- Comment #6 From Chris Lattner 2004-02-25 19:13:47 -------
I _really_ detest the AT&T style syntax for X86 assembly language.  That said,
it really doesn't matter what I like or don't like.  :)

Here are some observations:
1. Having size suffixes on instructions is occasionally quite useful.  For
   example, what exactly does this do:  %reg1024 = add %reg1026, %reg1028"?
   If it was an 'addl' you would know it's a 32-bit add.
2. GAS is buggy, period.  Until we have our own .o file writer, we will have
   to use it, and we don't want to require the latest and greatest binutils to
   use LLVM.  As such, I think we should definitely be generating AT&T style
   output on unixy systems.
3. We really need to keep support for intel output for support with
   MASM/TASM/etc on the windows side of things.  Especially given your latest
   successes with cygwin, we don't want to discard what we have there.
4. Most AT&T style opcodes are the same as the intel ones, they just have a
   [bwl] suffix on them.

Given all of this stuff.  How about we try this: the opcode names in the
instruction descriptions shall be the AT&T style names.  This makes #1 & #2
happy.  To emit intel style .s files to satisfy #3, we can default to taking the
AT&T opcode, stripping off the suffix letter (ie, take off the last letter if
it's a [bwl]), and printing the result.  I expect this to work for 90% or more
of the instruction opcodes.

If there are cases that don't fit this mold, we can have a little table that
handles them specifically for the intel printer, indicating what they map to. 
The output style will obviously be controlled by a flag, so I can view the
pretty intel syntax when I'm debugging the code generator.  :)

What do you think?

-Chris
------- Comment #7 From Brian R. Gaeke 2004-02-26 21:34:49 -------
I think your plan sounds reasonable. I had to shorten your summary, though. :-)
------- Comment #8 From Chris Lattner 2004-02-26 21:59:11 -------
I like the new subject line :)

-Chris
------- Comment #9 From Brian R. Gaeke 2004-02-26 22:00:42 -------
Note: This is related to:
    http://sources.redhat.com/bugzilla/show_bug.cgi?id=37
------- Comment #10 From Brian R. Gaeke 2004-03-10 13:18:20 -------
Not only are we going to have to do a real AT&T syntax GAS AsmWriter, but we're
going to have to 
make many (albeit trivial, I think) modifications to the Intel syntax AsmWriter
 to get the output to 
assemble with MASM, for example. That, however, is a discussion for another
bug.
------- Comment #11 From Brian R. Gaeke 2004-04-06 00:04:08 -------
I do not expect that I will be able to work on this bug in the near future.
Sorry!
------- Comment #12 From Chris Lattner 2004-10-25 17:12:11 -------
This bug was fixed when we got support for AT&T style asm syntax.

-Chris

First Last Prev Next    No search results available