From 5ec7e2e1d10e3e7e1ca1a760590b0f7a765f9567 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Tue, 1 Nov 2016 20:42:24 +0000 Subject: [PATCH] AMDGPU: Workaround for instruction size with literals Instructions with a 32-bit base encoding with an optional 32-bit literal encoded after them report their size as 4 for the disassembler. Consider these when computing the MachineInstr size. This fixes problems caused by size estimate consistency in BranchRelaxation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285743 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AMDGPU/SIDefines.h | 3 ++- lib/Target/AMDGPU/SIInstrFormats.td | 5 +++++ lib/Target/AMDGPU/SIInstrInfo.cpp | 13 ++++++++++++- lib/Target/AMDGPU/SIInstrInfo.h | 8 ++++++++ lib/Target/AMDGPU/SOPInstructions.td | 1 + 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/Target/AMDGPU/SIDefines.h b/lib/Target/AMDGPU/SIDefines.h index f48011fe5e1..5e6e754b532 100644 --- a/lib/Target/AMDGPU/SIDefines.h +++ b/lib/Target/AMDGPU/SIDefines.h @@ -45,7 +45,8 @@ enum { Gather4 = 1 << 26, DisableWQM = 1 << 27, SOPK_ZEXT = 1 << 28, - SCALAR_STORE = 1 << 29 + SCALAR_STORE = 1 << 29, + FIXED_SIZE = 1 << 30 }; } diff --git a/lib/Target/AMDGPU/SIInstrFormats.td b/lib/Target/AMDGPU/SIInstrFormats.td index 8976333412b..9dfe06fbb8e 100644 --- a/lib/Target/AMDGPU/SIInstrFormats.td +++ b/lib/Target/AMDGPU/SIInstrFormats.td @@ -65,6 +65,10 @@ class InstSI ScalarStore = 0; + // Whether the operands can be ignored when computing the + // instruction size. + field bits<1> FixedSize = 0; + // These need to be kept in sync with the enum in SIInstrFlags. let TSFlags{0} = VM_CNT; let TSFlags{1} = EXP_CNT; @@ -100,6 +104,7 @@ class InstSI