1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

250 Commits

Author SHA1 Message Date
Daniel Dunbar
ee525943d8 tblgen/AsmMatcher: Change AsmOperandClass to allow a list of superclasses instead of just one.
llvm-svn: 104452
2010-05-22 21:02:29 +00:00
Daniel Dunbar
711d2427dd MC/Matcher: Add support for over-riding the default MatchInstruction function
name (for example, to allow targets to interpose the actual MatchInstruction
function).

llvm-svn: 102987
2010-05-04 00:33:13 +00:00
Chris Lattner
b929ca1352 change Target.getInstructionsByEnumValue to return a reference
to a vector that CGT stores instead of synthesizing it on every 
call.

llvm-svn: 98910
2010-03-19 00:34:35 +00:00
Chris Lattner
1acf5e4a8d don't go through getInstructions().
llvm-svn: 98906
2010-03-19 00:18:23 +00:00
Daniel Dunbar
571a3eb0b6 MC/AsmMatcher: Add support for target specific "instruction cleanup" functions,
to allow custom post-processing of matched instructions.

llvm-svn: 98857
2010-03-18 20:05:56 +00:00
Daniel Dunbar
08f1b2f670 MC: Fix bug where trailing tied operands were forgotten; the X86 assembler
matcher is now free of implicit operands!
 - Still need to clean up the code now that we don't to worry about implicit
   operands, and to make it a hard error if an instruction fails to specify all
   of its operands for some reason.

llvm-svn: 95956
2010-02-12 01:46:54 +00:00
Daniel Dunbar
4254b19c9a MC/AsmMatcher: Tweak conversion function name.
llvm-svn: 95802
2010-02-10 21:00:47 +00:00
Daniel Dunbar
59cb3a1ca4 MC/AsmMatcher: Add support for creating tied operands when constructing MCInsts.
- Pretty messy, but we need to rework how we handle tied operands in MCInst
   anyway.

llvm-svn: 95774
2010-02-10 08:15:48 +00:00
Chris Lattner
804c2270c7 pass stringref by value instead of by const&
llvm-svn: 95627
2010-02-09 00:34:28 +00:00
Daniel Dunbar
9b2879bd70 AsmMatcherEmitter: Use stable_sort when reordering instructions, so that order
is still deterministic even amongst ambiguous instructions (eventually ambiguous
match orders will be a hard error, but we aren't there yet).

llvm-svn: 95157
2010-02-02 23:46:36 +00:00
Daniel Dunbar
0016281dc2 AsmMatcher: Create operand classes before use, apparently records aren't visited
in the order they were declared.

llvm-svn: 94868
2010-01-30 01:02:37 +00:00
Sean Callanan
1942b96584 Modified the register matcher function in AsmMatcher to
be static.  Also made it possible for clients to get it
and no other functions from ...GenAsmMatcher.inc by
defining REGISTERS_ONLY before including GenAsmMatcher.inc.
This sets the stage for target-specific lexers that can
identify registers and return AsmToken::Register as
appropriate.

llvm-svn: 94266
2010-01-23 00:40:33 +00:00
Daniel Dunbar
a0ef4e4068 AsmMatcher: Add a comment.
llvm-svn: 94261
2010-01-23 00:26:16 +00:00
Chris Lattner
882cb240a6 Split the TargetAsmParser "ParseInstruction" interface in half:
the new ParseInstruction method just parses and returns a list of
target operands.  A new MatchInstruction interface is used to
turn the operand list into an MCInst.

This requires new/deleting all the operands, but it also gives 
targets the ability to use polymorphic operands if they want to. 

llvm-svn: 93469
2010-01-14 22:21:20 +00:00
Daniel Dunbar
ec2e96e628 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
63f93255ae Add 'isCodeGenOnly' bit to Instruction .td records.
- Used to mark fake instructions which don't correspond to an actual machine
   instruction (or are duplicates of a real instruction). This is to be used for
   "special cases" in the .td files, which should be ignored by things like the
   assembler and disassembler. We still need a good solution to handle pervasive
   duplication, like with the Int_ instructions.

 - Set the bit on fake "mov 0" style instructions, which allows turning an
   assembler matcher warning into a hard error.

 - -2 FIXMEs.

llvm-svn: 78731
2009-08-11 22:17:52 +00:00
Daniel Dunbar
186ba504b3 llvm-mc/AsmParser: Allow target to specific a comment delimiter, which will be
used to strip hard coded comments out of .td assembly strings.

llvm-svn: 78716
2009-08-11 20:59:47 +00:00
Daniel Dunbar
4ba593dd3b llvm-mc/AsmMatcher: Fix two thinkos in determining whether two classes are
related.

llvm-svn: 78706
2009-08-11 20:10:07 +00:00
Daniel Dunbar
8cf3a3f1b2 llvm-mc/AsmParser: Implement automatic classification of RegisterClass operands.
- This drops us to 123 ambiguous instructions (previously ~500) on X86.

llvm-svn: 78636
2009-08-11 02:59:53 +00:00
Daniel Dunbar
15c79b6fd7 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
44acea594a llvm-mc/AsmMatcher: Remove some code which has been obsoleted by move to
explicit parser match classes.

llvm-svn: 78588
2009-08-10 19:08:50 +00:00
Daniel Dunbar
749ff1de5a llvm-mc/AsmMatcher: Change assembler parser match classes to their own record
structure.

llvm-svn: 78581
2009-08-10 18:41:10 +00:00
Daniel Dunbar
5ae2827607 llvm-mc/AsmParser: Check for matches with super classes when matching
instruction operands.

llvm-svn: 78565
2009-08-10 16:05:47 +00:00
Daniel Dunbar
4a1dbf6b74 llvm-mc/AsmParser: Fix thinko in ClassInfo::operator<.
llvm-svn: 78533
2009-08-09 08:23:23 +00:00
Daniel Dunbar
0984b029f8 llvm-mc/AsmParser: Add hack to ignore Int_* and *_Int instructions for now, to
make it easier to see interesting ambiguities.
 - Also, check that user doesn't try to redefine the super class. This is a wart
   in the current design, in that assembler match classes aren't explicitly
   declared somewhere (so there isn't a unique place to declare the super
   class). This should probably be fixed.

llvm-svn: 78532
2009-08-09 08:19:00 +00:00
Daniel Dunbar
15e6a41728 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
1d76f6d593 llvm-mc/AsmParser: Separate instruction ordering for ambiguity detection.
- We want the ordering operation to be simple, since we run it on every
   match. The old ordering is also not a strict weak ordering when there are
   ambiguities, which makes MSVC unhappy.

 - While we are at it, detect all ambiguities instead of just the adjacent
   ones. There are actually 655, for X86.

llvm-svn: 78526
2009-08-09 06:05:33 +00:00
Daniel Dunbar
dff8502076 llvm-mc/AsmParser: Define match classes in the .td file.
-2 FIXMEs.

llvm-svn: 78523
2009-08-09 05:18:30 +00:00
Daniel Dunbar
1785cfe884 llvm-mc/AsmParser: Sketch infrastructure for ordering instructions & detecting
ambiguities.
 - Currently there are 483 ambiguities to resolve. :)

llvm-svn: 78522
2009-08-09 04:00:06 +00:00
Chris Lattner
681f6ab2e1 fix edito
llvm-svn: 78520
2009-08-08 23:43:55 +00:00
Daniel Dunbar
1b075b4a8b llvm-mc/AsmMatcher: Tweak string matcher (missed a newline).
llvm-svn: 78518
2009-08-08 23:43:16 +00:00
Daniel Dunbar
50e3d6ae53 llvm-mc/AsmMatcher: Tweak string matcher.
- Track whether we need to insert an explicit 'break'.

 - Invert conditional when matching a single prefix to reduce
   nesting/bracing/breaking.

 - wc -l of X86GenAsmMatcher.inc decreased by 10%. :)

llvm-svn: 78513
2009-08-08 22:57:25 +00:00
Daniel Dunbar
246602757e 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
Chris Lattner
937d8cc72d add a little function to do arbitrary string pattern matching in a
much more efficient way than a sequence of if's.  Switch MatchRegisterName
to use it.  It would be nice if someone could factor this out to a shared
place in tblgen :)

llvm-svn: 78492
2009-08-08 20:02:57 +00:00
Chris Lattner
707da88ab6 add another const
llvm-svn: 78487
2009-08-08 19:16:05 +00:00
Chris Lattner
622dbecbe7 remove a useless anon-ns, make table const.
llvm-svn: 78486
2009-08-08 19:15:25 +00:00
Benjamin Kramer
f64c7475c7 MSVC doesn't like member variables with the same name as the class.
llvm-svn: 78462
2009-08-08 10:06:30 +00:00
Daniel Dunbar
07d36a8194 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
591187332c llvm-mc/AsmMatcher: Switch to a unified function to convert operands to MCInst,
so that terminal states are as simple as possible.
 - If we were willing to assume that the order that operands get inserted in the
   MCInst is fixed we could actually dispose with this altogether, although it
   might be nice to have the flexibility to change it later.

llvm-svn: 78458
2009-08-08 05:24:34 +00:00
Daniel Dunbar
876591a89d llvm-mc/AsmMatcher: Move emit for register -> enum matcher into a separate routine.
llvm-svn: 78408
2009-08-07 21:01:44 +00:00
Daniel Dunbar
ced1e5c532 llvm-mc/AsmMatcher: Tweaks in response to feedback.
llvm-svn: 78404
2009-08-07 20:33:39 +00:00
Daniel Dunbar
88ccb58384 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
e8765055ab TableGen / AsmMatcher: Tweaks to avoid generating completely bogus match
functions.
 - Fix variant flattening when the variant embeds an operand reference.

 - Ignore instructions which reference an operand multiple times (e.g., "xorb
   $dst, $dst"), and operands which have extra flags (e.g., "$dst:subreg32").

llvm-svn: 78099
2009-08-04 20:36:45 +00:00
Daniel Dunbar
8a0b05b396 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
41639473ed 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
Daniel Dunbar
e5df20a2dc Remove unintended changes.
llvm-svn: 77616
2009-07-30 18:29:44 +00:00
Daniel Dunbar
81f704c26a Twines: Don't allow implicit conversion from integers, this is too tricky.
llvm-svn: 77605
2009-07-30 17:37:43 +00:00
Daniel Dunbar
a364079155 Match X86 register names to number.
llvm-svn: 77404
2009-07-29 00:02:19 +00:00
Daniel Dunbar
d84feb8aa1 tblgen/AsmMatcher: Emit simple matcher for register names.
llvm-svn: 76212
2009-07-17 18:51:11 +00:00
Daniel Dunbar
2c046813c6 Stub out assembly matcher (.s -> MCInst) tblgen backend.
llvm-svn: 75378
2009-07-11 19:39:44 +00:00