OSDN Git Service

[AMDGPU] Disassembler: Added basic disassembler for AMDGPU target
authorTom Stellard <thomas.stellard@amd.com>
Thu, 18 Feb 2016 03:42:32 +0000 (03:42 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 18 Feb 2016 03:42:32 +0000 (03:42 +0000)
commit73fb8246268dda622d73252be182f2495595c21b
tree60bfe8a012edc96b7b1bd4e6d8044714ba579cae
parentb73d5ba466b8e0833465aac5a8711602d8cfeee4
[AMDGPU] Disassembler: Added basic disassembler for AMDGPU target

Changes:

- Added disassembler project
- Fixed all decoding conflicts in .td files
- Added DecoderMethod=“NONE” option to Target.td that allows to
  disable decoder generation for an instruction.
- Created decoding functions for VS_32 and VReg_32 register classes.
- Added stubs for decoding all register classes.
- Added several tests for disassembler

Disassembler only supports:

- VI subtarget
- VOP1 instruction encoding
- 32-bit register operands and inline constants

[Valery]

One of the point that requires to pay attention to is how decoder
conflicts were resolved:

- Groups of target instructions were separated by using different
  DecoderNamespace (SICI, VI, CI) using similar to AssemblerPredicate
  approach.

- There were conflicts in IMAGE_<> instructions caused by two
  different reasons:

1. dmask wasn’t specified for the output (fixed)
2. There are image instructions that differ only by the number of
   the address components but have the same encoding by the HW spec. The
   actual number of address components is determined by the HW at runtime
   using image resource descriptor starting from the VGPR encoded in an
   IMAGE instruction. This means that we should choose only one instruction
   from conflicting group to be the rule for decoder. I didn’t find the way
   to disable decoder generation for an arbitrary instruction and therefore
   made a onelinear fix to tablegen generator that would suppress decoder
   generation when DecoderMethod is set to “NONE”. This is a change that
   should be reviewed and submitted first. Otherwise I would need to
   specify different DecoderNamespace for every instruction in the
   conflicting group. I haven’t checked yet if DecoderMethod=“NONE” is not
   used in other targets.
3. IMAGE_GATHER decoder generation is for now disabled and to be
   done later.

[/Valery]

Patch By: Sam Kolton

Differential Revision: http://reviews.llvm.org/D16723

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261185 91177308-0d34-0410-b5e6-96231b3b80d8
15 files changed:
lib/Target/AMDGPU/AMDGPUInstructions.td
lib/Target/AMDGPU/CIInstructions.td
lib/Target/AMDGPU/CMakeLists.txt
lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp [new file with mode: 0644]
lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h [new file with mode: 0644]
lib/Target/AMDGPU/Disassembler/CMakeLists.txt [new file with mode: 0644]
lib/Target/AMDGPU/Disassembler/LLVMBuild.txt [new file with mode: 0644]
lib/Target/AMDGPU/LLVMBuild.txt
lib/Target/AMDGPU/SIInstrFormats.td
lib/Target/AMDGPU/SIInstrInfo.td
lib/Target/AMDGPU/SIInstructions.td
lib/Target/AMDGPU/VIInstructions.td
test/MC/Disassembler/AMDGPU/lit.local.cfg [new file with mode: 0644]
test/MC/Disassembler/AMDGPU/mov.txt [new file with mode: 0644]
test/MC/Disassembler/AMDGPU/nop.txt [new file with mode: 0644]