1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

250 Commits

Author SHA1 Message Date
Sean Silva
a07c612e3e Iterate deterministicaly over ClassInfo*'s
Fixes an observed instance of nondeterministic TableGen output.

Review by Jakob.

llvm-svn: 164191
2012-09-19 01:47:03 +00:00
Sean Silva
c291496fe7 Iterate deterministically over register classes
Fixes an observed instance of nondeterministic TableGen output.

Review by Jakob.

llvm-svn: 164190
2012-09-19 01:47:01 +00:00
Craig Topper
2c492a1861 Make custom operand parsing mnemonic indices use the same mnemonic table as the match table. Reorder fields in OperandMatchEntry to provide the least amount of padding for in tree targets.
llvm-svn: 164109
2012-09-18 07:02:21 +00:00
Craig Topper
c4107aa8c2 Use variable type for index into mnemonic table. Shrinks size of index field on in tree targets. Saving static data space.
llvm-svn: 164108
2012-09-18 06:10:45 +00:00
Craig Topper
24762462b0 Mark asm matcher conversion table as const.
llvm-svn: 164088
2012-09-18 01:41:49 +00:00
Craig Topper
5f44668251 Fix typo in comment. No functional change.
llvm-svn: 164086
2012-09-18 01:13:36 +00:00
Dmitri Gribenko
dd5d6c0da7 Fix Doxygen issues: wrap code examples in \code and use \p to refer to
parameters.

llvm-svn: 163984
2012-09-15 20:22:05 +00:00
Jim Grosbach
adfdb46f2c TableGen: Convert an assert() to a proper diagnostic.
llvm-svn: 163726
2012-09-12 17:40:25 +00:00
Chad Rosier
b75afa43e4 Fix function name per coding standard.
llvm-svn: 163187
2012-09-05 01:15:43 +00:00
Chad Rosier
63608419b5 Fix function name per coding standard.
llvm-svn: 163186
2012-09-05 01:02:38 +00:00
Chad Rosier
f24d0a24c7 [ms-inline asm] Make comment more verbose and add an assert.
llvm-svn: 163125
2012-09-03 20:37:01 +00:00
Chad Rosier
294688cf56 [ms-inline asm] Asm operands can map to one or more MCOperands. Therefore, add
the NumMCOperands argument to the GetMCInstOperandNum() function that is set
to the number of MCOperands this asm operand mapped to.

llvm-svn: 163124
2012-09-03 20:31:23 +00:00
Chad Rosier
bd31fcd8a9 [ms-inline asm] Add an interface to the GetMCInstOperandNum() function in the
MCTargetAsmParser class.

llvm-svn: 163122
2012-09-03 18:47:45 +00:00
Chad Rosier
2a0cfdfaf2 Remove extraneous return.
llvm-svn: 163119
2012-09-03 17:39:57 +00:00
Chad Rosier
7ed8b33ece [ms-inline asm] Return the MCOperandNum instead of passing a reference.
llvm-svn: 163118
2012-09-03 17:33:50 +00:00
Chad Rosier
fac2e7b419 Removed unused argument.
llvm-svn: 163104
2012-09-03 03:16:09 +00:00
Chad Rosier
6fbf85d859 [ms-inline asm] Expose the Kind and Opcode variables from the
MatchInstructionImpl() function.

These values are used by the ConvertToMCInst() function to index into the
ConversionTable.  The values are also needed to call the GetMCInstOperandNum()
function.

llvm-svn: 163101
2012-09-03 02:06:46 +00:00
Chad Rosier
1335fb4cf0 Remove an unused argument. The MCInst opcode is set in the ConvertToMCInst()
function nowadays.

llvm-svn: 163030
2012-08-31 22:12:31 +00:00
Chad Rosier
802539bb46 With the fix in r162954/162955 every cvt function returns true. Thus, have
the ConvertToMCInst() return void, rather then a bool.  Update all the cvt
functions as well.

llvm-svn: 162961
2012-08-31 00:03:31 +00:00
Chad Rosier
8c3aa99c95 Whitespace.
llvm-svn: 162946
2012-08-30 21:47:00 +00:00
Chad Rosier
4813beac7a Whitespace.
llvm-svn: 162945
2012-08-30 21:46:00 +00:00
Chad Rosier
2ba709e09b Hoist a check to eliminate obvious mismatches as early as possible. Also, fix
an 80-column violation in the generated code.  No functional change intended.

llvm-svn: 162944
2012-08-30 21:43:05 +00:00
Chad Rosier
17c35f6f3b [ms-inline asm] Add a new function, GetMCInstOperandNum, to the
AsmMatcherEmitter.  This function maps inline assembly operands to MCInst
operands.

For example, '__asm mov j, eax' is represented by the follow MCInst:

<MCInst 1460 <MCOperand Reg:0> <MCOperand Imm:1> <MCOperand Reg:0> 
             <MCOperand Expr:(j)> <MCOperand Reg:0> <MCOperand Reg:43>>

The first 5 MCInst operands are a result of j matching as a memory operand
consisting of a BaseReg (Reg:0), MemScale (Imm:1), MemIndexReg(Reg:0), 
Expr (Expr:(j), and a MemSegReg (Reg:0).  The 6th MCInst operand represents
the eax register (Reg:43).

This translation is necessary to determine the Input and Output Exprs.  If a
single asm operand maps to multiple MCInst operands, the index of the first
MCInst operand is returned.  Ideally, it would return the operand we really
care out (i.e., the Expr:(j) in this case), but I haven't found an easy way
of doing this yet.

llvm-svn: 162920
2012-08-30 17:59:25 +00:00
Andrew Trick
eeffae8b4e Fix a nondeterminism in the ARM assembler.
Adding arbitrary records to ARM.td would break
basic-arm-instructions.s because selection of nop vs mov r0,r0 was
ambiguous (this will be tested by a subsequent addition to ARM.td).
An imperfect but sensible fix is to give precedence to match rules
that have more constraints.

llvm-svn: 162824
2012-08-29 03:52:57 +00:00
Jakob Stoklund Olesen
4c8373f54e Print out the location of expanded multiclass defs in TableGen errors.
When reporting an error for a defm, we would previously only report the
location of the outer defm, which is not always where the error is.

Now we also print the location of the expanded multiclass defs:

lib/Target/X86/X86InstrSSE.td:2902:12: error: foo
  defm ADD : basic_sse12_fp_binop_s<0x58, "add", fadd, SSE_ALU_ITINS_S>,
             ^
lib/Target/X86/X86InstrSSE.td:2801:11: note: instantiated from multiclass
  defm PD : sse12_fp_packed<opc, !strconcat(OpcodeStr, "pd"), OpNode, VR128,
            ^
lib/Target/X86/X86InstrSSE.td:194:5: note: instantiated from multiclass
    def rm : PI<opc, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2),
        ^

llvm-svn: 162409
2012-08-22 23:33:58 +00:00
Jim Grosbach
282ab87aef TblGen: Make asm-matcher ConvertToMCInst() table driven.
No change in interface or functionality. Purely under-the-hood
details of the generated function that change.

The X86 assembly parser is reduced in size by over 15% and ARM by
over 10%.

No performance change by my measurements.

llvm-svn: 162337
2012-08-22 01:06:23 +00:00
Chad Rosier
3ef3f1b990 Formatting. No functional change.
llvm-svn: 162292
2012-08-21 17:22:47 +00:00
Akira Hatanaka
4e1b032521 Add stub methods for mips assembly matcher.
Patch by Vladimir Medic.

llvm-svn: 162124
2012-08-17 20:16:42 +00:00
Bill Wendling
5e0afec8b6 Remove extraneous ';'.
llvm-svn: 161298
2012-08-04 10:31:40 +00:00
Owen Anderson
cdcce931f2 Defer checking for registers in the MC AsmMatcher until the after user-defined match classes have been checked. This allows the creation of MatchClass's that are supersets of a register class.
llvm-svn: 160327
2012-07-16 23:20:09 +00:00
Jim Grosbach
7017237bdb TableGen: Assembly matcher 'insufficient operands' diagnostic.
Make sure the tblgen'erated asm matcher correctly returns numoperands+1
as the ErrorInfo when the problem was that there weren't enough operands
specified.

rdar://9142751

llvm-svn: 160144
2012-07-12 21:37:20 +00:00
Jim Grosbach
8f29aaf8fc TableGen: AsmMatcher diagnostics preference detail.
Don't override a custom diagnostic w/ a generic InvalidOperand, all else
being equal.

llvm-svn: 159238
2012-06-26 22:58:01 +00:00
Jim Grosbach
9bfc8e18b0 TableGen: AsmMatcher support for better operand diagnostics.
"Invalid operand" may be a completely correct diagnostic, but it's often
insufficiently specific to really help identify and fix the problem in
assembly source. Allow a target to specify a more-specific diagnostic kind
for each AsmOperandClass derived definition and use that to provide
more detailed diagnostics when an operant of that class resulted in a
match failure.

rdar://8987109

llvm-svn: 159050
2012-06-22 23:56:44 +00:00
Jim Grosbach
c116842e67 TableGen: AsmMatcher missing-features list minimization.
When returning a 'cannot match due to missing CPU features' error code,
if there are multiple potential matches with different feature sets,
return the smallest set of missing features from the alternatives as
that's most likely to be the one that's desired.

llvm-svn: 158673
2012-06-18 19:45:46 +00:00
Jakob Stoklund Olesen
2e87ef0470 Write llvm-tblgen backends as functions instead of sub-classes.
The TableGenBackend base class doesn't do much, and will be removed
completely soon.

Patch by Sean Silva!

llvm-svn: 158311
2012-06-11 15:37:55 +00:00
Jim Grosbach
d48551961d TableGen: AsmMatcher diagnostic when missing instruction mnemonic.
Previously, if an instruction definition was missing the mnemonic,
the next line would just assert(). Issue a real diagnostic instead.

llvm-svn: 156263
2012-05-06 17:33:14 +00:00
Douglas Gregor
0507cabcbd Move llvm-tblgen's StringMatcher into the TableGen library so it can
be used by clang-tblgen.

llvm-svn: 156000
2012-05-02 17:32:48 +00:00
Craig Topper
5828c654b9 Add ifdef around getSubtargetFeatureName in tablegen output file so that only targets that want the function get it. This prevents other targets from getting an unused function warning.
llvm-svn: 155538
2012-04-25 06:56:34 +00:00
Jim Grosbach
7ac2ac85a8 ARM: improved assembler diagnostics for missing CPU features.
When an instruction match is found, but the subtarget features it
requires are not available (missing floating point unit, or thumb vs arm
mode, for example), issue a diagnostic that identifies what the feature
mismatch is.

rdar://11257547

llvm-svn: 155499
2012-04-24 22:40:08 +00:00
Jim Grosbach
0cd0534390 TableGen support for auto-generating assembly two-operand aliases.
Assembly matchers for instructions with a two-operand form. ARM is full
of these, for example:
  add {Rd}, Rn, Rm  // Rd is optional and is the same as Rn if omitted.

The property TwoOperandAliasConstraint on the instruction definition controls
when, and if, an alias will be formed. No explicit InstAlias definitions
are required.

rdar://11255754

llvm-svn: 155172
2012-04-19 23:59:23 +00:00
Jim Grosbach
e8c60733b9 Use a SmallVector instead of std::vector for ResOperands.
There's almost always a small number of instruction operands, so
use a SmallVector and save on heap allocations.

llvm-svn: 155143
2012-04-19 17:52:34 +00:00
Jim Grosbach
d335490731 Update some internal naming conventions to modern style.
llvm-svn: 155142
2012-04-19 17:52:32 +00:00
Jim Grosbach
013a59646b Fix typo.
llvm-svn: 155075
2012-04-18 23:46:25 +00:00
Jim Grosbach
d32ea4a8a9 Sanity check error handling for TokenAlias.
llvm-svn: 154951
2012-04-17 21:23:52 +00:00
Jim Grosbach
ced1f200a3 Tidy up. 80 columns.
llvm-svn: 154881
2012-04-17 00:01:04 +00:00
Jim Grosbach
80c9f4d837 Tidy up. Remove hard tab characters.
llvm-svn: 154532
2012-04-11 21:02:33 +00:00
Craig Topper
52dc5e74e5 Reorder fields in MatchEntry and OperandMatchEntry to reduce padding. A bit tricky due to the target specific sizes for some of the fields so the ordering is only optimal for the targets in the tree.
llvm-svn: 153865
2012-04-02 07:48:39 +00:00
Jakob Stoklund Olesen
0d11262816 Make MnemonicTable const again. That part of r152202 was OK.
llvm-svn: 152840
2012-03-15 21:22:53 +00:00
Jakob Stoklund Olesen
01cebc3291 Don't assume all mnemonics fit in 64k.
We currently assume that all targets have less than 64k opcodes. We
shouldn't limit it further.

llvm-svn: 152833
2012-03-15 20:44:06 +00:00
Jakob Stoklund Olesen
16a890c018 Revert r152202: "Use uint16_t to store InstrNameIndices in MCInstrInfo."
We cannot limit the concatenated instruction names to 64K.  ARM is
already at 32K, and it is easy to imagine a target with more
instructions.

llvm-svn: 152817
2012-03-15 18:05:57 +00:00