Commit Graph

97 Commits

Author SHA1 Message Date
Chris Lattner f6d4129c76 specify a triple to use, fixing the test on non-x86-64 hosts.
llvm-svn: 91900
2009-12-22 07:01:12 +00:00
Chris Lattner dd0c01b5de various cleanups, make the disassemble reject lines with too much
data on them, for example:

	addb	%al, (%rax)
simple-tests.txt:11:5: error: excess data detected in input
0 0 0 0 0 
    ^

llvm-svn: 91896
2009-12-22 06:56:51 +00:00
Chris Lattner dc9845b79a rewrite the file parser for the disassembler, implementing support for
comments.  Also, check in a simple testcase for the disassembler,
including a test for r91864

llvm-svn: 91894
2009-12-22 06:37:58 +00:00
Daniel Dunbar 6a19c14968 Force triple in tests.
llvm-svn: 84257
2009-10-16 16:30:02 +00:00
Daniel Dunbar 5f339244fb MC: Tweak variable assignment diagnostics, and make reassignment of non-absolute
variables and symbols invalid.

llvm-svn: 84232
2009-10-16 01:57:39 +00:00
Daniel Dunbar d20cda028a MC: When parsing a variable reference, substitute absolute variables immediately
since they are allowed to be redefined.

llvm-svn: 84230
2009-10-16 01:34:54 +00:00
Kevin Enderby 818b6b96cb Fixed MCSectionMachO::ParseSectionSpecifier to allow an attribute of "none" so
that a symbol stub section with no attributes can be parsed as in:
.section __TEXT,__picsymbolstub4,symbol_stubs,none,16

llvm-svn: 83488
2009-10-07 20:57:20 +00:00
Daniel Dunbar c05f9a60d9 Move ARM and X86 specific AsmParser tests into separate subdirectories, and only
run if appropriate target is supported.

llvm-svn: 82419
2009-09-21 00:05:30 +00:00
Chris Lattner 4479034537 Add an intel syntax MCInstPrinter implementation. You can now
transcode from AT&T to intel syntax with "llvm-mc foo.s -output-asm-variant=1"

llvm-svn: 82385
2009-09-20 07:17:49 +00:00
Kevin Enderby ccab317837 Added the first bits of the ARM target assembler to llvm-mc. For now it only
parses the .word directive as 4 bytes and ARMAsmParser::ParseInstruction will
give an error is called.  Broke out the test of the .word directive into two
different test cases, one for x86 and one for arm.

llvm-svn: 81817
2009-09-15 00:27:25 +00:00
Chris Lattner b4370748b3 unbreak this test by working around an asmparser bug.
llvm-svn: 81724
2009-09-13 22:28:17 +00:00
Dan Gohman 87be9e7c78 Unbreak these tests. Chris, please verify that these changes are intended.
llvm-svn: 81217
2009-09-08 14:14:24 +00:00
Chris Lattner 438380aa4d use a darwin triple
llvm-svn: 80900
2009-09-03 06:15:11 +00:00
Chris Lattner 17b3a93ad0 adjust expected lines.
llvm-svn: 80898
2009-09-03 06:13:45 +00:00
Chris Lattner 11c989cc47 update test for alignment value in hex
llvm-svn: 80876
2009-09-03 04:03:44 +00:00
Daniel Dunbar 897ffadd2d llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
llvm-svn: 80578
2009-08-31 08:09:28 +00:00
Daniel Dunbar b7b2097aac llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
llvm-svn: 80577
2009-08-31 08:09:09 +00:00
Daniel Dunbar 73da11ebda llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.
Also, use MCInst::print instead of custom code in MCAsmPrinter.

llvm-svn: 80575
2009-08-31 08:08:38 +00:00
Daniel Dunbar 03686805e8 Update test.
llvm-svn: 80490
2009-08-30 07:01:09 +00:00
Daniel Dunbar 6a715dccdf llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now.
- Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency).

llvm-svn: 80484
2009-08-30 06:17:16 +00:00
Daniel Dunbar 2701eee0ad llvm-mc: Support .comm emission.
llvm-svn: 80351
2009-08-28 07:08:35 +00:00
Daniel Dunbar 42a39d038a llvm-mc: Support .zerofill emission.
- I'm still trying to figure out the cleanest way to implement this and match the assembler, currently there are some substantial differences.

llvm-svn: 80347
2009-08-28 05:49:21 +00:00
Daniel Dunbar 96abad185d llvm-mc: Emit .lcomm as .zerofill.
llvm-svn: 80343
2009-08-28 05:48:46 +00:00
Daniel Dunbar a1cb9ba541 For now, only run MC tests if X86 is configured.
llvm-svn: 80213
2009-08-27 06:11:15 +00:00
Daniel Dunbar 4d7b2e3307 llvm-mc/Mach-O: Unique sections properly, so we don't get duplicate text
sections, etc.
 - The quick and dirty way, just clone the TargetLoweringObjectFile
   code. Eventually this should be shared... somehow.

llvm-svn: 80168
2009-08-26 22:49:51 +00:00
Daniel Dunbar e73b267301 llvm-mc/Mach-O: Don't put assembler temporary labels in the symbol table.
- I moved section creation back into AsmParser. I think policy decisions like
   this should be pushed higher, not lower, when possible (in addition the
   assembler has flags which change this behavior, for example).

llvm-svn: 80162
2009-08-26 22:13:22 +00:00
Daniel Dunbar e2697738a4 llvm-mc/Mach-O: Set .subsections_via_symbols flag properly.
llvm-svn: 80144
2009-08-26 21:22:22 +00:00
Daniel Dunbar c4581eaca8 llvm-mc/Mach-O: Add support for relocations.
- I haven't really tried to find the "right" way to store the fixups or apply
   them, yet. This works, but isn't particularly elegant or fast.

 - Still no evaluation support, so we don't actually ever not turn a fixup into
   a relocation entry.

llvm-svn: 80089
2009-08-26 13:58:10 +00:00
Daniel Dunbar bee148a185 llvm-mc: Fix tests for python variations in int printing, sigh.
llvm-svn: 80069
2009-08-26 04:28:45 +00:00
Daniel Dunbar 066d0f93bf llvm-mc/Mach-O: Add section padding where needed (to align the next section).
Also, simplify some of Mach-O writer code which can now use section addresses.

llvm-svn: 80067
2009-08-26 04:13:32 +00:00
Daniel Dunbar aef5317edd llvm-mc/Mach-O: Set addresses for symbols.
llvm-svn: 80065
2009-08-26 02:48:04 +00:00
Daniel Dunbar c2c0bf961f llvm-mc: Improve indirect symbol support (add the indirect index table).
llvm-svn: 80059
2009-08-26 00:18:21 +00:00
Daniel Dunbar 04a1158d13 llvm-mc/Mach-O: Support symbol attributes.
- This is mostly complete, the main thing missing is .indirect_symbol support
   (which would be straight-forward, except that the way it is implemented in
   'as' makes getting an exact .o match interesting).

llvm-svn: 79899
2009-08-24 08:40:12 +00:00
Daniel Dunbar d1859474a7 llvm-mc/Mach-O: Improve symbol table support:
- Honor .globl.

 - Set symbol type and section correctly ('nm' now works), and order symbols
   appropriately.

 - Take care to the string table so that the .o matches 'as' exactly (for ease
   of testing).

llvm-svn: 79740
2009-08-22 11:41:10 +00:00
Daniel Dunbar 87671b7fdc Force triple for these tests.
llvm-svn: 79737
2009-08-22 09:45:43 +00:00
Daniel Dunbar 67dfb1de23 llvm-mc: Improve handling of implicit alignment for magic section directives
(e.g., .objc_message_refs).
 - Just emit a .align when we see the directive; this isn't exactly what 'as'
   does but in practice it should be ok, at least for now. See FIXME.

llvm-svn: 79697
2009-08-21 23:30:15 +00:00
Daniel Dunbar b1068e4fe3 llvm-mc/Mach-O: Support .o emission for .org and .align.
llvm-svn: 79684
2009-08-21 23:07:38 +00:00
Daniel Dunbar 4ef7fb9530 llvm-mc/Mach-O: Support byte and fill value emission.
llvm-svn: 79652
2009-08-21 18:29:01 +00:00
Daniel Dunbar 8e5edd81bb llvm-mc: Accept .fill size of 8.
llvm-svn: 79635
2009-08-21 15:43:35 +00:00
Daniel Dunbar 3016db39dd llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.

 - MCAssembler is the actual assembler backend, which is designed to have a
   reasonable API. This will eventually grow to support multiple object file
   implementations, but for now its Mach-O/i386 only.

 - MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
   e.g. converting the various directives into fragments, managing state like
   the current section, and so on.

 - llvm-mc will use the new backend via '-filetype=obj', which may eventually
   be, but is not yet, since I hear that people like assemblers which actually
   assemble.

 - The only thing that works at the moment is changing sections. For the time
   being I have a Python Mach-O dumping tool in test/scripts so this stuff can
   be easily tested, eventually I expect to replace this with a real LLVM tool.

 - More doxyments to come.

I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.

llvm-svn: 79612
2009-08-21 09:11:24 +00:00
Daniel Dunbar 45e5670ede Fix typo
llvm-svn: 79445
2009-08-19 18:35:54 +00:00
Chris Lattner 78b23b0e3f fix asmstreaming of 2/4 byte elements with pow-2 alignments.
llvm-svn: 79408
2009-08-19 06:35:36 +00:00
Daniel Dunbar 6cb1eb5a6d llvm-mc: Fix bugs where bytes were unintentionally being printed as signed.
- We now print all of 403.gcc cleanly (llvm-mc -> 'as' as diffed to 'as'), minus two 
   'rep;movsl' instructions (which I missed before).

llvm-svn: 79031
2009-08-14 19:59:24 +00:00
Daniel Dunbar c2346a3037 llvm-mc: When handling a .set, make sure to print subsequent references to the
symbol as the symbol name itself, not the expression it was defined to. These
have different semantics due to the quirky .set behavior (which absolutizes an
expression that would otherwise be treated as a relocation).

llvm-svn: 79025
2009-08-14 19:10:46 +00:00
Daniel Dunbar 563a7e87e3 llvm-mc: zerofill shouldn't print quotes around the section,segment.
llvm-svn: 79017
2009-08-14 18:51:45 +00:00
Daniel Dunbar ef668c169b llvm-mc: Support escaped characters in string literals (for .ascii and .asciz)
llvm-svn: 79010
2009-08-14 18:19:52 +00:00
Daniel Dunbar 80d484e7cc Update llvm-mc / MCAsmStreamer to print the instruction using the actual target
specific printer (this only works on x86, for now).
 - This makes it possible to do some correctness checking of the parsing and
   matching, since we can compare the results of 'as' on the original input, to
   those of 'as' on the output from llvm-mc.

 - In theory, we could now have an easy ATT -> Intel syntax converter. :)

llvm-svn: 78986
2009-08-14 03:48:55 +00:00
Daniel Dunbar 3fb754af06 llvm-mc/AsmParser: Match hard coded registers (e.g. 'shldl %cl, %eax, %eax')
We now match all of 403.gcc (as emitted by clang). :)

llvm-svn: 78750
2009-08-11 23:23:44 +00:00
Daniel Dunbar 7f8a9ebc8d llvm-mc: Fix a crash on invalid due to a typo in relocatable expression
evaluation.

llvm-svn: 78692
2009-08-11 17:47:52 +00:00
Daniel Dunbar 71527c1493 llvm-mc/X86: Parse '*' correctly (in the way the matcher expects).
llvm-svn: 78642
2009-08-11 05:00:25 +00:00