From 10c17ca6c6f5ceb01323c5cd8d7c446afa0ffa8c Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 6 Oct 2016 10:13:23 +0000 Subject: [PATCH] AMDGPU: Partially fix reported code size for some instructions These ones need to have the size on the pseudo instruction set for getInstSizeInBytes to work correctly. These also have a statically known size. llvm-svn: 283437 --- llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 3 ++- llvm/lib/Target/AMDGPU/BUFInstructions.td | 3 ++- llvm/lib/Target/AMDGPU/DSInstructions.td | 1 + llvm/lib/Target/AMDGPU/SOPInstructions.td | 5 +++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index e9bc119..ef73214 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -346,7 +346,8 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo, if (MI.isDebugValue()) continue; - CodeSize += TII->getInstSizeInBytes(MI); + if (isVerbose()) + CodeSize += TII->getInstSizeInBytes(MI); unsigned numOperands = MI.getNumOperands(); for (unsigned op_idx = 0; op_idx < numOperands; op_idx++) { diff --git a/llvm/lib/Target/AMDGPU/BUFInstructions.td b/llvm/lib/Target/AMDGPU/BUFInstructions.td index 220dd8d..01be18b 100644 --- a/llvm/lib/Target/AMDGPU/BUFInstructions.td +++ b/llvm/lib/Target/AMDGPU/BUFInstructions.td @@ -66,6 +66,7 @@ class MTBUF_Pseudo patt let LGKM_CNT = 1; let DS = 1; + let Size = 8; let UseNamedOperandTable = 1; let Uses = [M0, EXEC]; diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td index 5a42016..d31002b 100644 --- a/llvm/lib/Target/AMDGPU/SOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td @@ -575,8 +575,8 @@ def S_SETREG_B32 : SOPK_Pseudo < def S_SETREG_IMM32_B32 : SOPK_Pseudo < "s_setreg_imm32_b32", (outs), (ins i32imm:$imm, hwreg:$simm16), - "$simm16, $imm" -> { + "$simm16, $imm"> { + let Size = 8; // Unlike every other SOPK instruction. let has_sdst = 0; } @@ -688,6 +688,7 @@ class SOPP op, dag ins, string asm, list pattern = []> : let hasSideEffects = 0; let SALU = 1; let SOPP = 1; + let Size = 4; let SchedRW = [WriteSALU]; let UseNamedOperandTable = 1; -- 2.7.4