Commit Graph

330 Commits

Author SHA1 Message Date
Duncan Sands 6bd6a72e73 Avoid an unused variable warning when assertions are
disabled.

llvm-svn: 81122
2009-09-06 16:27:34 +00:00
Kevin Enderby 7d91218c75 Removed the non-target independent AsmToken::Register enum constant
from MCAsmLexer.h in preparation of supporting other targets.  Changed the
X86AsmParser code to reflect this by removing AsmLexer::LexPercent and looking
for AsmToken::Percent when parsing in places that used AsmToken::Register.
Then changed X86ATTAsmParser::ParseRegister to parse out registers as an
AsmToken::Percent followed by an AsmToken::Identifier.

llvm-svn: 80929
2009-09-03 17:15:07 +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 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 71527c1493 llvm-mc/X86: Parse '*' correctly (in the way the matcher expects).
llvm-svn: 78642
2009-08-11 05:00:25 +00:00
Daniel Dunbar aeb1feb67a llvm-mc/AsmParser: Allow .td users to redefine the names of the methods to call
on target specific operands for testing class membership and converting to
MCInst operands.

llvm-svn: 78597
2009-08-10 21:00:45 +00:00
Daniel Dunbar 8e33cb2de1 llvm-mc/AsmParser: Implement user defined super classes.
- We can now discriminate SUB32ri8 from SUB32ri, for example.

llvm-svn: 78530
2009-08-09 07:20:21 +00:00
Daniel Dunbar 66f4f54e8a llvm-mc/AsmMatcher: Switch token matching to use the new string matcher.
Also, redefined MatchRegisterName to just return the register value or a
sentinel, to simplify the generated code.

llvm-svn: 78504
2009-08-08 21:22:41 +00:00
Daniel Dunbar 541efcc5c4 llvm-mc/AsmMatcher: Improve match code.
- This doesn't actually improve the algorithm (its still linear), but the
   generated (match) code is now fairly compact and table driven. Still need a
   generic string matcher.

 - The table still needs to be compressed, this is quite simple to do and should
   shrink it to under 16k.

 - This also simplifies and restructures the code to make the match classes more
   explicit, in anticipation of resolving ambiguities.

llvm-svn: 78461
2009-08-08 07:50:56 +00:00
Daniel Dunbar 15b8037034 llvm-mc/AsmMatcher: Tweaks in response to feedback.
llvm-svn: 78404
2009-08-07 20:33:39 +00:00
Daniel Dunbar cf18d6befb Improve disabling of X86 AsmMatcher.
llvm-svn: 78381
2009-08-07 09:06:38 +00:00
Daniel Dunbar 32d0bb4c4e Disable X86 AsmMatcher for now, it is causing gcc-4.0 to run out of memory on
i386-apple-darwin9. This presumably will get fixed once the generated code
improves.

llvm-svn: 78379
2009-08-07 08:45:03 +00:00
Daniel Dunbar e10787e710 llvm-mc/AsmMatcher: Move to a slightly more sane matching design.
- Still not very sane, but a least its not 60k lines on X86. :)

 - In terms of correctness, currently some things are hard wired for X86, and we
   still don't properly resolve ambiguities (this is ignoring the instructions
   we don't even match due to funny .td stuff or other corner cases).

The high level changes:
 1. Represent tokens which are significant for matching explicitly as separate
    operands. This uniformly handles not only the instruction mnemonic, but
    also 'signficiant' syntax like the '*' in "call * ...".

 2. Separate the matching of operands to an instruction from the construction of
    the MCInst. In theory this can be done during matching, but since the number
    of variations is small I think it makes sense to decompose the problems.

 3. Improved a few of the mechanisms to at least successfully flatten / tokenize
    the assembly strings for PowerPC and ARM.

 4. The comment at the top of AsmMatcherEmitter.cpp explains the approach I'm
    moving towards for handling ambiguous instructions. The high-bit is to infer
    a partial ordering of the operand classes (and force the user to specify one
    if we can't) and use that to resolve ambiguities.

llvm-svn: 78378
2009-08-07 08:26:05 +00:00
Daniel Dunbar b2aebed2dc Change MCOperand to use Create style instead of Make style for constructing
operands.

llvm-svn: 77837
2009-08-02 00:09:22 +00:00
Daniel Dunbar a4fc8d94ce llvm-mc: A few more parsing / match tweaks.
- Operands which are just a label should be parsed as immediates, not memory
   operands (from the assembler perspective).

 - Match a few more flavors of immediates.

 - Distinguish match functions for memory operands which don't take a segment
   register.

 - We match the .s for "hello world" now!

llvm-svn: 77745
2009-07-31 22:22:54 +00:00
Daniel Dunbar 3ebf848b47 llvm-mc/X86: Sketch match functions for immediates and memory operands.
Also, change scale value to always be 1 when unspecified to machine MachineInst
encoding.

llvm-svn: 77728
2009-07-31 20:53:16 +00:00
Benjamin Kramer b60210ebab Fix a struct/class mismatch, to silence a MSVC warning.
llvm-svn: 77673
2009-07-31 11:35:26 +00:00
Daniel Dunbar b6d6aa2d22 llvm-mc: Match a few X86 instructions.
- This is "experimental" code, I am feeling my way around and working out the
   best way to do things (and learning tblgen in the process). Comments welcome,
   but keep in mind this stuff will change radically.

 - This is enough to match "subb" and friends, but not much else. The next step is to
   automatically generate the matchers for individual operands.

llvm-svn: 77657
2009-07-31 02:32:59 +00:00
Chris Lattner 4eb9df073d more syntactic cleanups.
llvm-svn: 77442
2009-07-29 06:33:53 +00:00
Chris Lattner 5e6e022770 minor smallvector cleanups
llvm-svn: 77441
2009-07-29 06:29:53 +00:00
Daniel Dunbar 0033199c50 Match X86 register names to number.
llvm-svn: 77404
2009-07-29 00:02:19 +00:00
Daniel Dunbar e1fdb0e8ce Move X86 instruction parsing into X86/AsmParser.
llvm-svn: 77384
2009-07-28 22:40:46 +00:00
Daniel Dunbar f59ee96a16 Provide generic MCAsmParser when constructing target specific parsers.
llvm-svn: 77362
2009-07-28 20:47:52 +00:00
Daniel Dunbar 52d03b252e llvm-mc: Move AsmLexer::getCurStrVal to StringRef based API.
- My DFS traversal of LLVM is, at least for now, nearly complete! :)

llvm-svn: 77258
2009-07-27 21:49:56 +00:00
Daniel Dunbar 5680b4f285 Add new helpers for registering targets.
- Less boilerplate == good.

llvm-svn: 77052
2009-07-25 06:49:55 +00:00
Daniel Dunbar 0ecb504508 Remove some unused code.
llvm-svn: 76541
2009-07-21 07:08:59 +00:00
Daniel Dunbar 2b11c7de4a Add MCAsmLexer interface.
- This provides the AsmLexer interface to the target specific assembly parsers.

llvm-svn: 76460
2009-07-20 20:01:54 +00:00
Daniel Dunbar 3c2a893ac7 Add MCAsmParser interface.
- This provides the AsmParser interface to the target specific assembly
   parsers.

llvm-svn: 76453
2009-07-20 18:55:04 +00:00
Daniel Dunbar 67038c1333 Put Target definitions inside Target specific header, and llvm namespace.
llvm-svn: 76344
2009-07-18 23:03:22 +00:00
Daniel Dunbar 71475775b9 Sketch support for target specific assembly parser.
- Not fully enabled yet, need a configure regeneration.

llvm-svn: 76230
2009-07-17 20:42:00 +00:00