llvm-6502/utils/TableGen
Chandler Carruth 7cd7154421 [x86] Fix a pretty horrible bug and inconsistency in the x86 asm
parsing (and latent bug in the instruction definitions).

This is effectively a revert of r136287 which tried to address
a specific and narrow case of immediate operands failing to be accepted
by x86 instructions with a pretty heavy hammer: it introduced a new kind
of operand that behaved differently. All of that is removed with this
commit, but the test cases are both preserved and enhanced.

The core problem that r136287 and this commit are trying to handle is
that gas accepts both of the following instructions:

  insertps $192, %xmm0, %xmm1
  insertps $-64, %xmm0, %xmm1

These will encode to the same byte sequence, with the immediate
occupying an 8-bit entry. The first form was fixed by r136287 but that
broke the prior handling of the second form! =[ Ironically, we would
still emit the second form in some cases and then be unable to
re-assemble the output.

The reason why the first instruction failed to be handled is because
prior to r136287 the operands ere marked 'i32i8imm' which forces them to
be sign-extenable. Clearly, that won't work for 192 in a single byte.
However, making thim zero-extended or "unsigned" doesn't really address
the core issue either because it breaks negative immediates. The correct
fix is to make these operands 'i8imm' reflecting that they can be either
signed or unsigned but must be 8-bit immediates. This patch backs out
r136287 and then changes those places as well as some others to use
'i8imm' rather than one of the extended variants.

Naturally, this broke something else. The custom DAG nodes had to be
updated to have a much more accurate type constraint of an i8 node, and
a bunch of Pat immediates needed to be specified as i8 values.

The fallout didn't end there though. We also then ceased to be able to
match the instruction-specific intrinsics to the instructions so
modified. Digging, this is because they too used i32 rather than i8 in
their signature. So I've also switched those intrinsics to i8 arguments
in line with the instructions.

In order to make the intrinsic adjustments of course, I also had to add
auto upgrading for the intrinsics.

I suspect that the intrinsic argument types may have led everything down
this rabbit hole. Pretty happy with the result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217310 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-06 10:00:01 +00:00
..
AsmMatcherEmitter.cpp Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size. 2014-08-21 05:55:13 +00:00
AsmWriterEmitter.cpp TableGen: Add 'static' to a large array to avoid a huge stack allocation 2014-07-17 19:43:40 +00:00
AsmWriterInst.cpp Remove dead code. 2013-12-02 05:10:04 +00:00
AsmWriterInst.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CallingConvEmitter.cpp Remove the target machine from CCState. Previously it was only used 2014-08-06 18:45:26 +00:00
CMakeLists.txt Move SetTheory from utils/TableGen into lib/TableGen so Clang can use it. 2014-06-17 13:10:38 +00:00
CodeEmitterGen.cpp Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
CodeGenDAGPatterns.cpp TableGen: Allow AddedComplexity values to be negative 2014-08-01 00:32:36 +00:00
CodeGenDAGPatterns.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CodeGenInstruction.cpp Add isInsertSubreg property. 2014-08-20 23:49:36 +00:00
CodeGenInstruction.h Add isInsertSubreg property. 2014-08-20 23:49:36 +00:00
CodeGenIntrinsics.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CodeGenMapTable.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 07:20:03 +00:00
CodeGenRegisters.cpp Fix some cases were ArrayRefs were being passed by reference. Also remove 'const' from some other ArrayRef uses since its implicitly const already. 2014-08-27 05:25:00 +00:00
CodeGenRegisters.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CodeGenSchedule.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 03:06:00 +00:00
CodeGenSchedule.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CodeGenTarget.cpp [stack protector] Fix a potential security bug in stack protector where the 2014-07-25 19:31:34 +00:00
CodeGenTarget.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CTagsEmitter.cpp TableGen: unique_ptr-ify RecordKeeper 2014-08-24 19:10:57 +00:00
DAGISelEmitter.cpp TableGen: Allow AddedComplexity values to be negative 2014-08-01 00:32:36 +00:00
DAGISelMatcher.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 07:20:03 +00:00
DAGISelMatcher.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
DAGISelMatcherEmitter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 07:20:03 +00:00
DAGISelMatcherGen.cpp TableGen: permit non-leaf ComplexPattern uses 2014-05-20 11:52:46 +00:00
DAGISelMatcherOpt.cpp Fix typos in comments, NFC 2014-08-29 21:53:01 +00:00
DFAPacketizerEmitter.cpp Simplify DFAPacketizerEmitter State copy/move semantics to use compiler defaults. 2014-04-21 22:58:00 +00:00
DisassemblerEmitter.cpp AArch64/ARM64: implement diagnosis of unpredictable loads & stores 2014-05-06 14:15:14 +00:00
FastISelEmitter.cpp [FastISel][tblgen] Rename tblgen generated FastISel functions. NFC. 2014-09-03 20:56:59 +00:00
FixedLenDecoderEmitter.cpp Use vector constructor instead of a for loop to initialize entries. 2014-09-04 04:49:03 +00:00
InstrInfoEmitter.cpp Add isInsertSubreg property. 2014-08-20 23:49:36 +00:00
IntrinsicEmitter.cpp Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created. 2014-08-27 05:25:25 +00:00
LLVMBuild.txt
Makefile
module.modulemap [modules] Add module maps for LLVM. These are not quite ready for prime-time 2014-05-21 02:46:14 +00:00
OptParserEmitter.cpp Option: Propagate flags from groups to options in each group 2014-07-12 00:18:58 +00:00
PseudoLoweringEmitter.cpp TableGen: unique_ptr-ify RecordKeeper 2014-08-24 19:10:57 +00:00
RegisterInfoEmitter.cpp [C++11] Use 'nullptr' in tablegen output files. 2014-04-30 05:53:35 +00:00
SequenceToOffsetTable.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
SubtargetEmitter.cpp Tablegen scheduling models don't reference empty itineraries as of r216919, so don't emit the unused itinerary variables 2014-09-02 23:23:34 +00:00
TableGen.cpp Move SetTheory from utils/TableGen into lib/TableGen so Clang can use it. 2014-06-17 13:10:38 +00:00
TableGenBackends.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
tdtags Add TableGen ctags(1) emitter and helper script. 2013-03-21 23:40:38 +00:00
X86DisassemblerShared.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
X86DisassemblerTables.cpp [SKX] avx512_icmp_packed multiclass extension 2014-08-25 14:49:34 +00:00
X86DisassemblerTables.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
X86ModRMFilters.cpp Second attempt at Removing special form of AddRegFrm used by FP instructions. These instructions can be handled by MRMXr instead. 2014-01-01 14:22:37 +00:00
X86ModRMFilters.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
X86RecognizableInstr.cpp [x86] Fix a pretty horrible bug and inconsistency in the x86 asm 2014-09-06 10:00:01 +00:00
X86RecognizableInstr.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00