1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 11:33:24 +02:00
Commit Graph

3269 Commits

Author SHA1 Message Date
David Woodhouse
d30df6b04f [x86] Fix disassembly of MOV16ao16 et al.
The addition of IC_OPSIZE_ADSIZE in r198759 wasn't quite complete. It
also turns out to have been unnecessary. The disassembler handles the
AdSize prefix for itself, and doesn't care about the difference between
(e.g.) MOV8ao8 and MOB8ao8_16 definitions. So just let them coexist and
don't worry about it.

llvm-svn: 199654
2014-01-20 12:02:53 +00:00
Craig Topper
f63b7bc430 Allow x86 mov instructions to/from memory with absolute address to be encoded and disassembled with a segment override prefix. Fixes PR16962.
llvm-svn: 199364
2014-01-16 07:36:58 +00:00
Kostya Serebryany
28ba07921c replace LeakSanitizerIsTurnedOffForTheCurrentProcess with __lsan_is_turned_off, but this time hide it under __has_feature(address_sanitizer); also include <sanitizer/lsan_interface.h>
llvm-svn: 199303
2014-01-15 07:59:37 +00:00
Craig Topper
57fa50f4c8 Simplify x86 disassembler table handling of when to use TYPE_Rv/TYPE_R16/TYPE_R32 now that HasOpSizePrefix only means 16-bit instructions.
llvm-svn: 199295
2014-01-15 05:02:02 +00:00
Lang Hames
28c512a65e Add FPExt option to CCValAssign::LocInfo. When generating calling-convention
promotion code, Tablegen will now select FPExt for floating point promotions
(previously it had returned AExt, which is not valid for floating point types).

Any out-of-tree targets that were relying on AExt being returned for FP
promotions will need to update their code check for FPExt instead.

llvm-svn: 199252
2014-01-14 19:56:36 +00:00
Craig Topper
2b2eb7f7cc Remove stray comma in enum to satisfy -Wpedantic.
llvm-svn: 199194
2014-01-14 08:07:10 +00:00
Craig Topper
1c1ecbff81 Separate the concept of 16-bit/32-bit operand size controlled by 0x66 prefix and the current mode from the concept of SSE instructions using 0x66 prefix as part of their encoding without being affected by the mode.
This should allow SSE instructions to be encoded correctly in 16-bit mode which r198586 probably broke.

llvm-svn: 199193
2014-01-14 07:41:20 +00:00
Elena Demikhovsky
e635ade802 AVX-512: Embedded Rounding Control - encoding and printing
Changed intrinsics for vrcp14/vrcp28 vrsqrt14/vrsqrt28 - aligned with GCC.

llvm-svn: 199102
2014-01-13 12:55:03 +00:00
Roman Divacky
e429f2c937 Constant propagate MachineInstrClassName.
llvm-svn: 198969
2014-01-10 22:59:49 +00:00
Rafael Espindola
728814cedc All backends use MC now.
llvm-svn: 198959
2014-01-10 21:49:27 +00:00
Kostya Serebryany
25ca0cb80c reapply r198858: Disable LeakSanitizer in TableGen binaries, see PR18325; this time LeakSanitizerIsTurnedOffForTheCurrentProcess is used instead of __lsan_is_turned_off
llvm-svn: 198922
2014-01-10 08:05:42 +00:00
Alp Toker
671c9fe7b0 Revert "Disable LeakSanitizer in TableGen binaries, see PR18325"
To declare or define reserved identifers is undefined behaviour in standard
C++. This needs to be addressed in compiler-rt before it can be used in LLVM.

See the list discussion for details.

This reverts commit r198858.

llvm-svn: 198884
2014-01-09 19:40:55 +00:00
Kostya Serebryany
dfd3aa3e35 Disable LeakSanitizer in TableGen binaries, see PR18325
llvm-svn: 198858
2014-01-09 09:26:26 +00:00
David Woodhouse
399c563e5e [x86] Fix MOV8ao8 et al for 16-bit mode, fix up disassembler to understand
It seems there is no separate instruction class for having AdSize *and*
OpSize bits set, which is required in order to disambiguate between all
these instructions. So add that to the disassembler.

Hm, perhaps we do need an AdSize16 bit after all?

llvm-svn: 198759
2014-01-08 12:58:24 +00:00
Craig Topper
d4c2e3f15e The rest of r198588. Remove SegOvrBits from X86 TSFlags since they weren't being used.
llvm-svn: 198589
2014-01-06 06:57:27 +00:00
Craig Topper
60c74a0e11 Use patterns to remove some duplicate instructions.
llvm-svn: 198550
2014-01-05 06:55:48 +00:00
Craig Topper
3ff26e1332 Fix encoding for PUSH64i16. Add In64BitMode Predicate. Remove disassembler hack.
llvm-svn: 198547
2014-01-05 05:46:38 +00:00
Craig Topper
5601f6ca67 Remove no longer needed x86 disassembler hack.
llvm-svn: 198546
2014-01-05 05:10:07 +00:00
Craig Topper
eea372cfa3 Mark x86 _alt instructions as AsmParserOnly so they will be omitted from disassembler without string matches.
llvm-svn: 198545
2014-01-05 04:55:55 +00:00
Craig Topper
0b1961cfbc Use new ForceDisassemble flag on the 2-byte forms of INC/DEC for 32-bit mode and remove disassmbler table emitter hack.
llvm-svn: 198544
2014-01-05 04:32:42 +00:00
Craig Topper
4a48c26e38 Add a new x86 specific instruction flag to force some isCodeGenOnly instructions to go through to the disassembler tables without resorting to string matches. Apply flag to all _REV instructions.
llvm-svn: 198543
2014-01-05 04:17:28 +00:00
Craig Topper
83505ed565 Mark the 64-bit x86 push/pop instructions as In64BitMode. Mark the corresponding 32-bit versions with the same encodings Not64BitMode. Remove hack from tablegen disassembler table emitter. Fix bad test.
llvm-svn: 198530
2014-01-05 01:35:51 +00:00
Craig Topper
036a8781b5 Don't use PrintFatalError(which calls exit) for 'Primary decode conflict'. Just skip emitting the table. This way the main function will delete the output file instead of it remaining empty and confusing dependency checks if build is invoked a second time.
llvm-svn: 198529
2014-01-05 01:34:12 +00:00
Craig Topper
0418d1dd5a Tag x86 move to/from debug/control registers with Not64BitMode/In64BitMode. Remove disassembler hack.
llvm-svn: 198515
2014-01-04 22:29:41 +00:00
Craig Topper
4c535886dc Remove JMP64pcrel32 (jmpq ). There are no tests for it. I'm pretty sure it won't be emitted correctly since it was set to NoImm. And I can't prove that gas accepts 'jmpq' with an immediate either. Remove the special case for it from the disassembler table generator.
llvm-svn: 198475
2014-01-04 05:09:27 +00:00
Hal Finkel
ed9bcf6074 [TableGen] Handle ValueType in CodeGenDAGPatterns GetNumNodeResults
A ValueType in a pattern dag is a type cast, and GetNumNodeResults should
handle it (the type cast has only one result).

This comes up, for example, during the type checking of pattern fragments, for
example, AArch64's Neon_combine_2d fragment is:
  dag Operands = (ops node:$Rm, node:$Rn);
  dag Fragment = (v2f64 (concat_vectors (v1f64 node:$Rm), (v1f64 node:$Rn)));

llvm-svn: 198347
2014-01-02 20:47:05 +00:00
Craig Topper
839231f528 Mark REX64_PREFIX as In64BitMode, remove hack from X86RecognizableInstr.
llvm-svn: 198336
2014-01-02 19:12:10 +00:00
Craig Topper
c88fd21439 Remove unused HasFROperands field from disassembler.
llvm-svn: 198332
2014-01-02 18:44:21 +00:00
Craig Topper
ba17ca1e89 Mark PUSHFS64/PUSHGS64/POPFS64/POPGS64 as In64BitMode and remove the hack from the disassembler table builder.
llvm-svn: 198327
2014-01-02 18:20:48 +00:00
Craig Topper
9cf0c703a1 Remove unnecessary stirng comparison from disassembler.
llvm-svn: 198325
2014-01-02 17:41:40 +00:00
Craig Topper
57b949fa83 Mark all x86 Int_ and _Int patterns as isCodeGenOnly so the disassembler table builder doesn't need to string match them to exclude them.
llvm-svn: 198323
2014-01-02 17:28:14 +00:00
Craig Topper
f98f744453 Remove unused function argument.
llvm-svn: 198291
2014-01-02 03:58:45 +00:00
Craig Topper
b3f7e28cb6 Remove modifierType/Base from X86 disassembler tables as they are no longer used. Removes ~11.5K from static tables.
llvm-svn: 198284
2014-01-01 21:52:57 +00:00
Craig Topper
9d2e15270b Remove need for MODIFIER_OPCODE in the disassembler tables. AddRegFrms are really more like OrRegFrm so we don't need a difference since we can just mask bits.
llvm-svn: 198278
2014-01-01 15:29:32 +00:00
Elena Demikhovsky
7174584583 AVX-512: Added intrinsics for vcvt, vcvtt, vrndscale, vcmp
Printing rounding control.
Enncoding for EVEX_RC (rounding control).

llvm-svn: 198277
2014-01-01 15:12:34 +00:00
Craig Topper
4454a2fa93 Second attempt at Removing special form of AddRegFrm used by FP instructions. These instructions can be handled by MRMXr instead.
llvm-svn: 198276
2014-01-01 14:22:37 +00:00
Craig Topper
d0374cb642 Revert r198238 and add FP disassembler tests. It didn't work and I didn't realized we had no FP disassembler test cases.
llvm-svn: 198265
2013-12-31 17:21:44 +00:00
Craig Topper
c4a2189f05 Remove special form of AddRegFrm used by FP instructions. These instructions can be handled by MRMXr instead.
llvm-svn: 198238
2013-12-30 19:16:48 +00:00
Craig Topper
e7fc7befa8 Remove EscapeFilter. It's funcionality can be covered by correctly using ExtendedFilter and ExactFilter. No functional change.
llvm-svn: 198226
2013-12-30 17:37:10 +00:00
Craig Topper
b6dc80fa3a Simplify filter accepts function to just return 'condition' instead of branching to return true/false. No functional change.
llvm-svn: 198221
2013-12-30 17:22:20 +00:00
Elena Demikhovsky
e1e562fcd2 AVX-512: decoder for AVX-512, made by Alexey Bader.
llvm-svn: 198013
2013-12-25 11:40:51 +00:00
Eric Christopher
24d8bb6edd [x86] Rename In32BitMode predicate to Not64BitMode
That's what it actually means, and with 16-bit support it's going to be
a little more relevant since in a few corner cases we may actually want
to distinguish between 16-bit and 32-bit mode (for example the bare 'push'
aliases to pushw/pushl etc.)

Patch by David Woodhouse

llvm-svn: 197768
2013-12-20 02:04:49 +00:00
Hal Finkel
860adf085f Add support for positionally-encoded operands to FixedLenDecoderEmitter
Unfortunately, the PowerPC instruction definitions make heavy use of the
positional operand encoding heuristic to map operands onto bitfield variables
in the instruction definitions. Changing this to use name-based mapping is not
trivial, however, because additional infrastructure needs to be designed to
handle mapping of complex operands (with multiple suboperands) onto multiple
bitfield variables.

In the mean time, this adds support for positionally encoded operands to
FixedLenDecoderEmitter, so that we can generate a disassembler for the PowerPC
backend. To prevent an accidental reliance on this feature, and to prevent an
undesirable interaction with existing disassemblers, a backend must opt-in to
this support by setting the new decodePositionallyEncodedOperands
instruction-set bit to true.

When enabled, this iterates the variables that contribute to the instruction
encoding, just as the encoder does, and emulates the procedure the encoder uses
to map "numbered" operands to variables. The bit range for each variable is
also determined as the encoder determines them. This map is then consulted
during the decoder-generator's loop over operands to decode, allowing the
decoder to understand both position-based and name-based operand-to-variable
mappings.

As noted in the comment on the decodePositionallyEncodedOperands definition,
this support should be removed once it is no longer needed. There should be no
change to existing disassemblers.

llvm-svn: 197691
2013-12-19 16:12:53 +00:00
Hal Finkel
75f8d9984e Add support for PointerLikeRegClass to FixedLenDecoderEmitter
This is more prep for adding the PowerPC disassembler. FixedLenDecoderEmitter
should recognize PointerLikeRegClass operands as register types, and generate
register-like decoding calls instead of treating them like immediates.

llvm-svn: 197680
2013-12-19 14:58:22 +00:00
Hal Finkel
773f2038fd Support little-endian encodings in the FixedLenDecoderEmitter
The convention used to specify the PowerPC ISA is that bits are numbered in
reverse order (0 is the index of the high bit). To support this "little endian"
encoding convention, CodeEmitterGen will reverse the bit numberings prior to
generating the encoding tables. In order to generate a disassembler,
FixedLenDecoderEmitter needs to do the same.

This moves the bit reversal logic out of CodeEmitterGen and into CodeGenTarget
(where it can be used by both CodeEmitterGen and FixedLenDecoderEmitter). This
is prep work for disassembly support in the PPC backend (which is the only
in-tree user of this little-endian encoding support).

llvm-svn: 197532
2013-12-17 22:37:50 +00:00
Elena Demikhovsky
b43ccbc3f7 AVX-512: Added legal type MVT::i1 and VK1 register for it.
Added scalar compare VCMPSS, VCMPSD.
Implemented LowerSELECT for scalar FP operations.
I replaced FSETCCss, FSETCCsd with one node type FSETCCs.
Node extract_vector_elt(v16i1/v8i1, idx) returns an element of type i1.

llvm-svn: 197384
2013-12-16 13:52:35 +00:00
Alp Toker
e845f8af67 Correct word hyphenations
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities and contractions in nearby lines.

llvm-svn: 196471
2013-12-05 05:44:44 +00:00
Rafael Espindola
299ef825a5 Remove dead code.
llvm-svn: 196066
2013-12-02 05:10:04 +00:00
Juergen Ributzka
990c8318f8 [weak vtables] Place class definitions into anonymous namespaces to prevent weak vtables.
This patch places class definitions in implementation files into anonymous
namespaces to prevent weak vtables. This eliminates the need of providing an
out-of-line definition to pin the vtable explicitly to the file.

llvm-svn: 195092
2013-11-19 03:08:35 +00:00
Juergen Ributzka
5357a6d64b [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file. The memory leaks in this version have been fixed. Thanks
Alexey for pointing them out.

Differential Revision: http://llvm-reviews.chandlerc.com/D2068

Reviewed by Andy

llvm-svn: 195064
2013-11-19 00:57:56 +00:00
Alexey Samsonov
3bfef6bdb6 Revert r194865 and r194874.
This change is incorrect. If you delete virtual destructor of both a base class
and a subclass, then the following code:
  Base *foo = new Child();
  delete foo;
will not cause the destructor for members of Child class. As a result, I observe
plently of memory leaks. Notable examples I investigated are:
ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl.

llvm-svn: 194997
2013-11-18 09:31:53 +00:00
Ahmed Bougacha
d1d34b8908 TableGen: Generate an enum for all named Operand types in tblgen'd InstrInfo.
llvm-svn: 194978
2013-11-17 21:24:41 +00:00
Owen Anderson
04f460b741 Small improvement to InstrinsicEmitter::EmitAttributes. This change removes the “pushing” and “clearing” of the SmallVector and instead uses const arrays to pass the attributeKinds to AttributeSet::get .
Patch by Aditya Nandakumar.

llvm-svn: 194899
2013-11-16 00:20:01 +00:00
Juergen Ributzka
ee3af15269 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.

Differential Revision: http://llvm-reviews.chandlerc.com/D2068

Reviewed by Andy

llvm-svn: 194865
2013-11-15 22:34:48 +00:00
Elena Demikhovsky
841cd7d09e AVX-512: added VPCONFLICT instruction and intrinsics,
added EVEX_KZ to tablegen

llvm-svn: 193959
2013-11-03 13:46:31 +00:00
Andrew Trick
be4d0aecc4 Lower stackmap intrinsics directly to their target opcode in the DAG builder.
llvm-svn: 193769
2013-10-31 17:18:24 +00:00
Andrew Trick
a8fb62f09f Enable variable arguments support for intrinsics.
llvm-svn: 193766
2013-10-31 17:18:11 +00:00
Andrew Trick
48c4e0c740 whitespace
llvm-svn: 193765
2013-10-31 17:18:07 +00:00
Ahmed Bougacha
ad22d8e3c1 TableGen: remove unused variable.
llvm-svn: 193527
2013-10-28 18:19:04 +00:00
Ahmed Bougacha
3761482703 TableGen: Refactor DAG patterns to enable parsing one pattern at a time.
llvm-svn: 193526
2013-10-28 18:07:21 +00:00
Ahmed Bougacha
c3336e00d9 TableGen: Refactor AsmWriterEmitter to keep AsmWriterInsts.
These used to be referenced by the CGI->AWI map (in AsmWriterEmitter), but
stored in a vector local to EmitPrintInstruction. Move the vector to
AsmWriterEmitter too.

llvm-svn: 193525
2013-10-28 18:07:17 +00:00
Peter Collingbourne
1dd4748985 Typo.
llvm-svn: 193043
2013-10-20 03:19:25 +00:00
Craig Topper
1548551887 Allow pinsrw/pinsrb/pextrb/pextrw/movmskps/movmskpd/pmovmskb/extractps instructions to parse either GR32 or GR64 without resorting to duplicating instructions.
llvm-svn: 192567
2013-10-14 04:55:01 +00:00
Craig Topper
47d75426b9 Remove more filters from the disassembler. Mark some AVX512 instructions as CodeGenOnly.
llvm-svn: 192525
2013-10-12 05:41:08 +00:00
Craig Topper
1e89b25474 Mark some more instructions as CodeGenOnly. Remove filters from the disassembler.
llvm-svn: 192522
2013-10-12 04:46:18 +00:00
Will Dietz
2703980be5 Add missing #include's to cctype when using isdigit/alpha/etc.
llvm-svn: 192519
2013-10-12 00:55:57 +00:00
Craig Topper
4bd0420e99 Remove another unnecessary filter from the disassembler.
llvm-svn: 192425
2013-10-11 06:59:57 +00:00
Craig Topper
5478d3f8df Fix so CRC32r64r8 isn't accidentally filtered from the disassembler tables.
llvm-svn: 192339
2013-10-10 04:26:52 +00:00
Craig Topper
36e55db0c3 More x86 disassembler filtering cleanup.
llvm-svn: 192279
2013-10-09 06:12:53 +00:00
Craig Topper
78a2070f4a Remove some old filters from the x86 disassembler table builder.
llvm-svn: 192275
2013-10-09 05:02:29 +00:00
Craig Topper
4c3cbfbbbc Remove unneeded MMX instruction definition by moving pattern to an equivalent instruction definition and removing the filtering from the disassembler table building.
llvm-svn: 192175
2013-10-08 06:30:39 +00:00
Craig Topper
aa1a4d51f0 Remove some instructions that existed to provide aliases to the assembler. Can be done with InstAlias instead. Unfortunately, this was causing printer to use 'vmovq' or 'vmovd' based on what was parsed. To cleanup the inconsistencies convert all 'vmovd' with 64-bit registers to 'vmovq', but provide an alias so that 'vmovd' will still parse.
llvm-svn: 192171
2013-10-08 05:53:50 +00:00
Craig Topper
6e389a510f Remove some instructions that seem to only exist to trick the filtering checks in the disassembler table creation. Just fix up the filter to let the real instruction through instead.
llvm-svn: 192090
2013-10-07 07:19:47 +00:00
Craig Topper
b5918acf04 Add disassembler support for long encodings for INC/DEC in 32-bit mode.
llvm-svn: 192086
2013-10-07 04:28:06 +00:00
Craig Topper
4fe6b1993f Add OPC_CheckChildSame0-3 to the DAG isel matcher. This replaces sequences of MoveChild, CheckSame, MoveParent. Saves 846 bytes from the X86 DAG isel matcher, ~300 from ARM, ~840 from Hexagon.
llvm-svn: 192026
2013-10-05 05:38:16 +00:00
Craig Topper
67bc19ea4d Revert r191940 to see if it fixes the build bots.
llvm-svn: 191941
2013-10-04 05:52:17 +00:00
Craig Topper
fb07bce847 Add OPC_CheckChildSame0-3 to the DAG isel matcher. This replaces sequences of MoveChild, CheckSame, MoveParent. Saves 846 bytes from the X86 DAG isel matcher, ~300 from ARM, ~840 from Hexagon.
llvm-svn: 191940
2013-10-04 05:22:20 +00:00
Craig Topper
6fb0648c41 Add XOP disassembler support. Fixes PR13933.
llvm-svn: 191874
2013-10-03 05:17:48 +00:00
Pete Cooper
9b04f39eb6 Add v4f16 to supported value types.
This is useful for some ARM intrinsics such as VCVTN which does a <4 x float> <-> <4 x half> conversion.

llvm-svn: 191870
2013-10-03 03:29:21 +00:00
Rafael Espindola
a279462828 Remove several unused variables.
Patch by Alp Toker.

llvm-svn: 191757
2013-10-01 13:32:03 +00:00
Richard Sandiford
ffc286beba Fix pattern sort in DAGISelEmitter.cpp
The old code skipped one of the sorting criteria if either pattern had
no types.  This could lead to cycles of the form X < Y, Y < Z, Z < X.

llvm-svn: 191735
2013-10-01 09:49:01 +00:00
Craig Topper
977585f6e1 Filter out repeated sections from the X86 disassembler modRMTable. Saves about ~43K from a released build. Unfortunately the disassembler tables are still upwards of 800K.
llvm-svn: 191652
2013-09-30 06:23:19 +00:00
Craig Topper
a4bd7d9c3c Various x86 disassembler fixes.
Add VEX_LIG to scalar FMA4 instructions.
Use VEX_LIG in some of the inheriting checks in disassembler table generator.
Make use of VEX_L_W, VEX_L_W_XS, VEX_L_W_XD contexts.
Don't let VEX_L_W, VEX_L_W_XS, VEX_L_W_XD, VEX_L_W_OPSIZE inherit from their non-L forms unless VEX_LIG is set.
Let VEX_L_W, VEX_L_W_XS, VEX_L_W_XD, VEX_L_W_OPSIZE inherit from all of their non-L or non-W cases.
Increase ranking on VEX_L_W, VEX_L_W_XS, VEX_L_W_XD, VEX_L_W_OPSIZE so they get chosen over non-L/non-W forms.

llvm-svn: 191649
2013-09-30 02:46:36 +00:00
Andrew Trick
65c09c6381 Mark the x86 machine model as incomplete. PR17367.
Ideally, the machinel model is added at the time the instructions are
defined. But many instructions in X86InstrSSE.td still need a model.

Without this workaround the scheduler asserts because x86 already has
itinerary classes for these instructions, indicating they should be
modeled by the scheduler. Since we use the new machine model for other
instructions, it expects a new machine model for these too.

llvm-svn: 191391
2013-09-25 18:14:12 +00:00
Craig Topper
2218fcf390 Fix doxygen comments to use correct function name.
llvm-svn: 191356
2013-09-25 06:40:22 +00:00
Craig Topper
8a20a83619 Replace EVT with MVT in CodeGenDAGAPatterns.cpp.
llvm-svn: 191355
2013-09-25 06:37:18 +00:00
Craig Topper
934d05a5c5 Fix formatting to match coding standards.
llvm-svn: 191280
2013-09-24 06:21:04 +00:00
Jiangning Liu
5867567c41 Initial support for Neon scalar instructions.
Patch by Ana Pazos.

1.Added support for v1ix and v1fx types.
2.Added Scalar Pairwise Reduce instructions.
3.Added initial implementation of Scalar Arithmetic instructions.

llvm-svn: 191263
2013-09-24 02:47:27 +00:00
Craig Topper
da9463b38d Add missing index comments to the left side of the DAG ISel matcher table for each individual case of SwitchOpcode/Type.
llvm-svn: 191181
2013-09-22 23:18:50 +00:00
Benjamin Kramer
1308256cf8 Provide basic type safety for array_pod_sort comparators.
This makes using array_pod_sort significantly safer. The implementation relies
on function pointer casting but that should be safe as we're dealing with void*
here.

llvm-svn: 191175
2013-09-22 14:09:50 +00:00
Tim Northover
a89953876c TableGen: fix constness of new comparison function.
libc++ didn't seem to like a non-const call operator.

llvm-svn: 190797
2013-09-16 17:33:40 +00:00
Tim Northover
efd2bb2366 TableGen: give asm match classes deterministic order.
TableGen was sorting the entries in some of its internal data
structures by pointer. This order filtered through to the final
matching table and affected the diagnostics produced on bad assembly
occasionally.

It also turns out STL algorithms are ridiculously easy to misuse on
containers with custom order methods. (No bugs before, or now that I
know of, but plenty in the middle).

This should fix the sanitizer bot, which ends up with weird pointers.

llvm-svn: 190793
2013-09-16 16:43:19 +00:00
Tim Northover
aa157f020e AsmMatcher: emit subtarget feature enum in deterministic order.
llvm-svn: 190792
2013-09-16 16:43:16 +00:00
Benjamin Kramer
b6950f09cc Replace some unnecessary vector copies with references.
llvm-svn: 190770
2013-09-15 22:04:42 +00:00
Joey Gouly
fccb3bcae3 Add an instruction deprecation feature to TableGen.
The 'Deprecated' class allows you to specify a SubtargetFeature that the
instruction is deprecated on.

The 'ComplexDeprecationPredicate' class allows you to define a custom
predicate that is called to check for deprecation.
For example:
  ComplexDeprecationPredicate<"MCR">

would mean you would have to define the following function:
  bool getMCRDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI,
                             std::string &Info)

Which returns 'false' for not deprecated, and 'true' for deprecated
and store the warning message in 'Info'.

The MCTargetAsmParser constructor was chaned to take an extra argument of
the MCInstrInfo class, so out-of-tree targets will need to be changed.

llvm-svn: 190598
2013-09-12 10:28:05 +00:00
Benjamin Kramer
0f63cd14e9 llvm-tblgen: Mangle operand replacements into the strings in printAliasInstr.
Cuts down the bloat in the AArch64 asm writer a bit.

llvm-svn: 190527
2013-09-11 15:42:16 +00:00
Benjamin Kramer
4182059208 llvm-tblgen: Stabilize subreg index tables.
Otherwise SequenceToOffsetTable will sort by pointer and becomes non-deterministic.

llvm-svn: 190514
2013-09-11 11:22:26 +00:00
Vincent Lejeune
b888e36466 TableGen: Enumerate Schedule Model too.
llvm-svn: 189839
2013-09-03 19:43:28 +00:00
Jim Grosbach
644f2f8be2 Tidy up. Comment grammar.
llvm-svn: 189618
2013-08-29 22:41:43 +00:00
Jim Grosbach
ebb869a49c Tidy up. Trailing whitespace.
llvm-svn: 189617
2013-08-29 22:41:39 +00:00
Craig Topper
7e8c45d44b Move StringToOffsetTable into the TableGen include directory so I can use it in clang.
llvm-svn: 189567
2013-08-29 05:09:55 +00:00
Rui Ueyama
3ab487af0b Option parsing: support case-insensitive option matching.
Re-submitting r189416 with fix for Windows build on where strcasecmp is not defined.

llvm-svn: 189501
2013-08-28 20:04:31 +00:00
Craig Topper
90be9b3ab8 Add missing include
llvm-svn: 189448
2013-08-28 07:03:02 +00:00
Rui Ueyama
16ae963b6a Revert "Option parsing: support case-insensitive option matching." as it broke Windows buildbot.
This reverts r189416.

llvm-svn: 189424
2013-08-28 00:02:06 +00:00
Rui Ueyama
a9f9cbaaf6 Option parsing: support case-insensitive option matching.
Link.exe's command line options are case-insensitive. This patch
adds a new attribute to OptTable to let the option parser to compare
options, ignoring case.

Command lines are generally case-insensitive on Windows. CL.exe is an
exception. So this new attribute should be useful for other commands
running on Windows.

Differential Revision: http://llvm-reviews.chandlerc.com/D1485

llvm-svn: 189416
2013-08-27 23:47:01 +00:00
Jakob Stoklund Olesen
af78d7a3df Add an OtherPreserved field to the CalleeSaved TableGen class.
This field specifies registers that are preserved across function calls,
but that should not be included in the generates SaveList array.

This can be used ot generate regmasks for architectures that save
registers through other means, like SPARC's register windows.

llvm-svn: 189084
2013-08-23 02:25:47 +00:00
Elena Demikhovsky
5488806c84 AVX-512: Added masked SHIFT commands, more encoding tests
llvm-svn: 189005
2013-08-22 12:18:28 +00:00
Tim Northover
eb7a86ed88 ARM: use TableGen patterns to select CMOV operations.
Back in the mists of time (2008), it seems TableGen couldn't handle the
patterns necessary to match ARM's CMOV node that we convert select operations
to, so we wrote a lot of fairly hairy C++ to do it for us.

TableGen can deal with it now: there were a few minor differences to CodeGen
(see tests), but nothing obviously worse that I could see, so we should
probably address anything that *does* come up in a localised manner.

llvm-svn: 188995
2013-08-22 09:57:11 +00:00
Aaron Ballman
ad58ec7c10 Fixing a warning about control reaching the end of a non-void function.
llvm-svn: 188524
2013-08-16 01:43:31 +00:00
Jack Carter
15a173ab4f [Mips][msa] Value types for MSA support.
Added v8f16 to ValueTypes.h, ValueTypes.cpp, ValueTypes.td, 
and CodeGenTarget.cpp

Patch by Daniel Sanders

llvm-svn: 188326
2013-08-13 22:34:26 +00:00
Richard Sandiford
ceb50ae8d3 Revert r188164: Stablize MCK_Reg ordering in AsmMatcherEmitter
Apparently caused a failure on Darwin

llvm-svn: 188166
2013-08-12 10:57:51 +00:00
Richard Sandiford
5b47e9993e Stablize MCK_Reg ordering in AsmMatcherEmitter
clang bootstraps intermittently failed for me due a difference in
the MCK_Reg ordering in ARMGenAsmMatcher.inc.  E.g. in my latest
run the stage 1 and stage 3 versions were the same but the stage 2
one was different (though still functionally correct).  This meant
that the .o comparison failed.

MCK_Regs were assigned by iterating over a std::set< std::set<Record*> >,
and since std::set is sorted lexicographically, the order depended on the
order of the pointer values.  This patch replaces the pointer ordering
with LessRecordByID.

llvm-svn: 188164
2013-08-12 10:39:45 +00:00
Reid Kleckner
59f77601ec Remove some std stream usage from Support and TableGen
LLVM's coding standards recommend raw_ostream and MemoryBuffer for
reading and writing text.

This has the side effect of allowing clang to compile more of Support
and TableGen in the Microsoft C++ ABI.

llvm-svn: 187826
2013-08-06 22:51:21 +00:00
Vladimir Medic
03a431cc4d Moving definition of MnemonicContainsDot field from class Instruction to class AsmParser as suggested.
llvm-svn: 187569
2013-08-01 09:25:27 +00:00
Hans Wennborg
9c475c6d9d Option parsing: remove non-SUPPORT_ALIASARGS fall-back
The clients of this code have been updated to all support AliasArgs.

This depends on Clang r187538 and lld r187541.

llvm-svn: 187546
2013-07-31 23:28:51 +00:00
Hans Wennborg
ad911dcfea Option parsing: add support for alias arguments.
This makes option aliases more powerful by enabling them to
pass along arguments to the option they're aliasing.

For example, if we have a joined option "-foo=", we can now
specify a flag option "-bar" to be an alias of that, with the
argument "baz".

This is especially useful for the cl.exe compatible clang driver,
where many options are aliases. For example, this patch enables
us to alias "/Ox" to "-O3" (-O is a joined option), and "/WX" to
"-Werror" (again, -W is a joined option).

Differential Revision: http://llvm-reviews.chandlerc.com/D1245

llvm-svn: 187537
2013-07-31 22:44:41 +00:00
Andrew Trick
9565b1b595 comment typo.
llvm-svn: 187531
2013-07-31 21:05:54 +00:00
Tom Stellard
b013a4ba0d Revert "TableGen: Enumerate Schedule Model too."
This reverts commit 2ca1e4a39c7e0d7a00e66ff5437c6d7ace2404a0.

llvm-svn: 187525
2013-07-31 20:43:08 +00:00
Vincent Lejeune
aed9766321 TableGen: Enumerate Schedule Model too.
llvm-svn: 187511
2013-07-31 19:31:20 +00:00
Andrew Trick
d6e72c514e Fix register pressure tables on ARM.
The heuristic that merges register pressure sets was bogus for ARM's S/D regs.

llvm-svn: 187479
2013-07-31 03:24:31 +00:00
Andrew Trick
d1cd65d51c Add tracing to the tblgen register pressure table generator.
llvm-svn: 187478
2013-07-31 03:24:28 +00:00
Craig Topper
b18d7964ca Remove use of sprintf added to X86 disassembler tablegen code. Send message with instruction name to errs() instead and use a generic message for the llvm_unreachable. Consistent with other places in this file.
llvm-svn: 187333
2013-07-28 21:28:02 +00:00
Elena Demikhovsky
a7a8eb9496 fixed compilation issue
llvm-svn: 187325
2013-07-28 08:45:12 +00:00
Elena Demikhovsky
505373db43 Added encoding prefixes for KNL instructions (EVEX).
Added 512-bit operands printing.
Added instruction formats for KNL instructions.

llvm-svn: 187324
2013-07-28 08:28:38 +00:00
Aaron Ballman
aedb990ba6 Using a different loop induction variable than the enclosing scope. No functional changes intended.
llvm-svn: 187159
2013-07-25 22:09:31 +00:00
Justin Holewinski
0a336ca9e0 Fix a bug in TableGen where the intrinsic function name recognizer could mis-identify names if one was a prefix substring of the other
For two intrinsics 'llvm.nvvm.texsurf.handle' and 'llvm.nvvm.texsurf.handle.internal',
TableGen was emitting matching code like:

  if (Name.startswith("llvm.nvvm.texsurf.handle")) ...
  if (Name.startswith("llvm.nvvm.texsurf.handle.internal")) ...

We can never match "llvm.nvvm.texsurf.handle.internal" here because it will
always be erroneously matched by the first condition.

The fix is to sort the intrinsic names and emit them in reverse order.

llvm-svn: 187119
2013-07-25 12:32:00 +00:00
Andrew Trick
a33731be51 RegPressure: Order the "pressure sets" by number of regunits per set.
This lets heuristics easily pick the most important set to follow.

llvm-svn: 187108
2013-07-25 07:26:29 +00:00
Craig Topper
9bf1d910c8 Split generated asm mnemonic matching table into a separate table for each asm variant.
This removes the need to store the asm variant in each row of the single table that existed before. Shaves ~16K off the size of X86AsmParser.o.

llvm-svn: 187026
2013-07-24 07:33:14 +00:00
Craig Topper
6c816aee2a Remove 'else' after 'return'. No functional change.
llvm-svn: 186929
2013-07-23 06:27:36 +00:00
Craig Topper
e053d0d3ac Remove trailing whitespace.
llvm-svn: 186928
2013-07-23 06:25:00 +00:00
Vladimir Medic
8b47c63b77 This patch allows targets to define weather the instruction mnemonics in asm matcher tables will contain '.' character.
llvm-svn: 186388
2013-07-16 09:22:38 +00:00
Aaron Ballman
fd493b4851 Teaching llvm-tblgen to not emit a switch statement when there are no case statements.
llvm-svn: 186330
2013-07-15 16:53:32 +00:00
Craig Topper
642bfedd2e Add 'const' qualifier to some arrays.
llvm-svn: 186312
2013-07-15 08:02:13 +00:00
Craig Topper
58fa7a9b4a Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size.
llvm-svn: 186274
2013-07-14 04:42:23 +00:00
Nick Lewycky
7b093a1c2f Extend 'readonly' and 'readnone' to work on function arguments as well as
functions. Make the function attributes pass add it to known library functions
and when it can deduce it.

llvm-svn: 185735
2013-07-06 00:29:58 +00:00
Craig Topper
783617eba7 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
llvm-svn: 185606
2013-07-04 01:31:24 +00:00
Chad Rosier
1ce13129c7 Improve the compression of the tablegen DiffLists by introducing a new sort
algorithm when assigning EnumValues to the synthesized registers.

The current algorithm, LessRecord, uses the StringRef compare_numeric
function.  This function compares strings, while handling embedded numbers.
For example, the R600 backend registers are sorted as follows:

  T1
  T1_W
  T1_X
  T1_XYZW
  T1_Y
  T1_Z
  T2
  T2_W
  T2_X
  T2_XYZW
  T2_Y
  T2_Z

In this example, the 'scaling factor' is dEnum/dN = 6 because T0, T1, T2
have an EnumValue offset of 6 from one another.  However, in other parts
of the register bank, the scaling factors are different:

dEnum/dN = 5:
  KC0_128_W
  KC0_128_X
  KC0_128_XYZW
  KC0_128_Y
  KC0_128_Z
  KC0_129_W
  KC0_129_X
  KC0_129_XYZW
  KC0_129_Y
  KC0_129_Z

The diff lists do not work correctly because different kinds of registers have
different 'scaling factors'.  This new algorithm, LessRecordRegister, tries to
enforce a scaling factor of 1.  For example, the registers are now sorted as
follows:

  T1
  T2
  T3
  ...
  T0_W
  T1_W
  T2_W
  ...
  T0_X
  T1_X
  T2_X
  ...
  KC0_128_W
  KC0_129_W
  KC0_130_W
  ...

For the Mips and R600 I see a 19% and 6% reduction in size, respectively.  I
did see a few small regressions, but the differences were on the order of a
few bytes (e.g., AArch64 was 16 bytes).  I suspect there will be even
greater wins for targets with larger register files.

Patch reviewed by Jakob.
rdar://14006013

llvm-svn: 185094
2013-06-27 19:38:13 +00:00
Tom Stellard
e230cd96cd TableGen: Generate a function for getting operand indices based on their defined names
This patch modifies TableGen to generate a function in
${TARGET}GenInstrInfo.inc called getNamedOperandIdx(), which can be used
to look up indices for operands based on their names.

In order to activate this feature for an instruction, you must set the
UseNamedOperandTable bit.

For example, if you have an instruction like:

def ADD : TargetInstr <(outs GPR:$dst), (ins GPR:$src0, GPR:$src1)>;

You can look up the operand indices using the new function, like this:

Target::getNamedOperandIdx(Target::ADD, Target::OpName::dst)  => 0
Target::getNamedOperandIdx(Target::ADD, Target::OpName::src0) => 1
Target::getNamedOperandIdx(Target::ADD, Target::OpName::src1) => 2

The operand names are case sensitive, so $dst and $DST are considered
different operands.

This change is useful for R600 which has instructions with a large number
of operands, many of which model single bit instruction configuration
values.  These configuration bits are common across most instructions,
but may have a different operand index depending on the instruction type.
It is useful to have a convenient way to look up the operand indices,
so these bits can be generically set on any instruction.

llvm-svn: 184879
2013-06-25 21:22:09 +00:00
Stefanus Du Toit
aa267b3e82 Add support for encoding the HLE XACQUIRE and XRELEASE prefixes.
For decoding, keep the current behavior of always decoding these as their REP
versions. In the future, this could be improved to recognize the cases where
these behave as XACQUIRE and XRELEASE and decode them as such.

llvm-svn: 184207
2013-06-18 17:08:10 +00:00
Andrew Trick
768a74cb96 Support BufferSize on ProcResGroup for unified MOp schedulers.
And add Sandybridge/Haswell resource buffers.

llvm-svn: 184034
2013-06-15 04:50:06 +00:00
Andrew Trick
5d13fe97ed Machine Model: Add MicroOpBufferSize and resource BufferSize.
Replace the ill-defined MinLatency and ILPWindow properties with
with straightforward buffer sizes:
MCSchedMode::MicroOpBufferSize
MCProcResourceDesc::BufferSize

These can be used to more precisely model instruction execution if desired.

Disabled some misched tests temporarily. They'll be reenabled in a few commits.

llvm-svn: 184032
2013-06-15 04:49:57 +00:00
Benjamin Kramer
6f76e633ad tblgen: Assert that InstRWs doesn't grows when we don't expect it.
llvm-svn: 183690
2013-06-10 20:19:35 +00:00
Benjamin Kramer
d0217d5a59 tblgen: always lookup values from the original vector as it could be grown under our feet.
PR16281.

llvm-svn: 183630
2013-06-09 15:20:23 +00:00
Arnold Schwaighofer
f006a2373b CodeGenSchedule: Use resize instead of copying a vector
llvm-svn: 183465
2013-06-07 00:04:30 +00:00
Arnold Schwaighofer
958c7590f3 CodeGenSchedule: smallvector.push_back(smallvector[0]) is dangerous
The element passed to push_back is not copied before the vector reallocates.
The client needs to copy the element first before passing it to push_back.

No test case, will be tested by follow-up swift scheduler model change (it
segfaults without this change).

llvm-svn: 183459
2013-06-06 23:23:14 +00:00
Jakub Staszak
fe013a66d3 Remove unimplemented definition. Found using [-Wunused-member-function].
llvm-svn: 183426
2013-06-06 17:52:45 +00:00
Arnold Schwaighofer
07e27c55de SubtargetEmitter fix
Don't output data if we are supposed to ignore the record.

Reapply of 183255, I don't think this was causing the tablegen segfault on linux
testers.

llvm-svn: 183311
2013-06-05 14:06:50 +00:00
Andrew Trick
d3d6d1e61c Fix a tblgen subtargetemitter bug, for future Swift support.
This fixes some of the ridiculously complex code for optimizing the
machine model tables that are shared among all processors of a given
target. A9 and Swift both use the "special" feature that maps old
itinerary classes to new machine model defs. They map different
overlapping subsets of instructions, which wasn't handled correctly.

llvm-svn: 183302
2013-06-05 06:55:20 +00:00
Arnold Schwaighofer
59cf81c2e1 Revert series of sched model patches until I figure out what is going on.
llvm-svn: 183273
2013-06-04 22:35:17 +00:00
Arnold Schwaighofer
10d37229fb SubtargetEmitter fix
Don't output data if we are supposed to ignore the record.

llvm-svn: 183255
2013-06-04 22:15:41 +00:00