LCOV - code coverage report
Current view: top level - lib/Target/AMDGPU - AMDGPUArgumentUsageInfo.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 38 67 56.7 %
Date: 2018-10-19 05:06:59 Functions: 5 7 71.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===----------------------------------------------------------------------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #include "AMDGPU.h"
      11             : #include "AMDGPUArgumentUsageInfo.h"
      12             : #include "SIRegisterInfo.h"
      13             : #include "llvm/Support/raw_ostream.h"
      14             : 
      15             : using namespace llvm;
      16             : 
      17             : #define DEBUG_TYPE "amdgpu-argument-reg-usage-info"
      18             : 
      19      284086 : INITIALIZE_PASS(AMDGPUArgumentUsageInfo, DEBUG_TYPE,
      20             :                 "Argument Register Usage Information Storage", false, true)
      21             : 
      22           0 : void ArgDescriptor::print(raw_ostream &OS,
      23             :                           const TargetRegisterInfo *TRI) const {
      24           0 :   if (!isSet()) {
      25           0 :     OS << "<not set>\n";
      26           0 :     return;
      27             :   }
      28             : 
      29           0 :   if (isRegister())
      30           0 :     OS << "Reg " << printReg(getRegister(), TRI) << '\n';
      31             :   else
      32           0 :     OS << "Stack offset " << getStackOffset() << '\n';
      33             : }
      34             : 
      35             : char AMDGPUArgumentUsageInfo::ID = 0;
      36             : 
      37             : const AMDGPUFunctionArgInfo AMDGPUArgumentUsageInfo::ExternFunctionInfo{};
      38             : 
      39        2228 : bool AMDGPUArgumentUsageInfo::doInitialization(Module &M) {
      40        2228 :   return false;
      41             : }
      42             : 
      43        2218 : bool AMDGPUArgumentUsageInfo::doFinalization(Module &M) {
      44        2218 :   ArgInfoMap.clear();
      45        2218 :   return false;
      46             : }
      47             : 
      48           0 : void AMDGPUArgumentUsageInfo::print(raw_ostream &OS, const Module *M) const {
      49           0 :   for (const auto &FI : ArgInfoMap) {
      50           0 :     OS << "Arguments for " << FI.first->getName() << '\n'
      51           0 :        << "  PrivateSegmentBuffer: " << FI.second.PrivateSegmentBuffer
      52           0 :        << "  DispatchPtr: " << FI.second.DispatchPtr
      53           0 :        << "  QueuePtr: " << FI.second.QueuePtr
      54           0 :        << "  KernargSegmentPtr: " << FI.second.KernargSegmentPtr
      55           0 :        << "  DispatchID: " << FI.second.DispatchID
      56           0 :        << "  FlatScratchInit: " << FI.second.FlatScratchInit
      57           0 :        << "  PrivateSegmentSize: " << FI.second.PrivateSegmentSize
      58           0 :        << "  WorkGroupIDX: " << FI.second.WorkGroupIDX
      59           0 :        << "  WorkGroupIDY: " << FI.second.WorkGroupIDY
      60           0 :        << "  WorkGroupIDZ: " << FI.second.WorkGroupIDZ
      61           0 :        << "  WorkGroupInfo: " << FI.second.WorkGroupInfo
      62             :        << "  PrivateSegmentWaveByteOffset: "
      63           0 :           << FI.second.PrivateSegmentWaveByteOffset
      64           0 :        << "  ImplicitBufferPtr: " << FI.second.ImplicitBufferPtr
      65           0 :        << "  ImplicitArgPtr: " << FI.second.ImplicitArgPtr
      66           0 :        << "  WorkItemIDX " << FI.second.WorkItemIDX
      67           0 :        << "  WorkItemIDY " << FI.second.WorkItemIDY
      68           0 :        << "  WorkItemIDZ " << FI.second.WorkItemIDZ
      69             :        << '\n';
      70             :   }
      71           0 : }
      72             : 
      73             : std::pair<const ArgDescriptor *, const TargetRegisterClass *>
      74       64230 : AMDGPUFunctionArgInfo::getPreloadedValue(
      75             :   AMDGPUFunctionArgInfo::PreloadedValue Value) const {
      76       64230 :   switch (Value) {
      77         931 :   case AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_BUFFER: {
      78             :     return std::make_pair(
      79         931 :       PrivateSegmentBuffer ? &PrivateSegmentBuffer : nullptr,
      80             :       &AMDGPU::SGPR_128RegClass);
      81             :   }
      82           2 :   case AMDGPUFunctionArgInfo::IMPLICIT_BUFFER_PTR:
      83           2 :     return std::make_pair(ImplicitBufferPtr ? &ImplicitBufferPtr : nullptr,
      84             :                           &AMDGPU::SGPR_64RegClass);
      85         644 :   case AMDGPUFunctionArgInfo::WORKGROUP_ID_X:
      86         644 :     return std::make_pair(WorkGroupIDX ? &WorkGroupIDX : nullptr,
      87             :                           &AMDGPU::SGPR_32RegClass);
      88             : 
      89         619 :   case AMDGPUFunctionArgInfo::WORKGROUP_ID_Y:
      90         619 :     return std::make_pair(WorkGroupIDY ? &WorkGroupIDY : nullptr,
      91             :                           &AMDGPU::SGPR_32RegClass);
      92         619 :   case AMDGPUFunctionArgInfo::WORKGROUP_ID_Z:
      93         619 :     return std::make_pair(WorkGroupIDZ ? &WorkGroupIDZ : nullptr,
      94             :                           &AMDGPU::SGPR_32RegClass);
      95        1481 :   case AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_WAVE_BYTE_OFFSET:
      96             :     return std::make_pair(
      97        1481 :       PrivateSegmentWaveByteOffset ? &PrivateSegmentWaveByteOffset : nullptr,
      98             :       &AMDGPU::SGPR_32RegClass);
      99       55406 :   case AMDGPUFunctionArgInfo::KERNARG_SEGMENT_PTR:
     100       55406 :     return std::make_pair(KernargSegmentPtr ? &KernargSegmentPtr : nullptr,
     101             :                           &AMDGPU::SGPR_64RegClass);
     102         597 :   case AMDGPUFunctionArgInfo::IMPLICIT_ARG_PTR:
     103         597 :     return std::make_pair(ImplicitArgPtr ? &ImplicitArgPtr : nullptr,
     104             :                           &AMDGPU::SGPR_64RegClass);
     105         590 :   case AMDGPUFunctionArgInfo::DISPATCH_ID:
     106         590 :     return std::make_pair(DispatchID ? &DispatchID : nullptr,
     107             :                           &AMDGPU::SGPR_64RegClass);
     108         381 :   case AMDGPUFunctionArgInfo::FLAT_SCRATCH_INIT:
     109         381 :     return std::make_pair(FlatScratchInit ? &FlatScratchInit : nullptr,
     110             :                           &AMDGPU::SGPR_64RegClass);
     111         624 :   case AMDGPUFunctionArgInfo::DISPATCH_PTR:
     112         624 :     return std::make_pair(DispatchPtr ? &DispatchPtr : nullptr,
     113             :                           &AMDGPU::SGPR_64RegClass);
     114         591 :   case AMDGPUFunctionArgInfo::QUEUE_PTR:
     115         591 :     return std::make_pair(QueuePtr ? &QueuePtr : nullptr,
     116             :                           &AMDGPU::SGPR_64RegClass);
     117         585 :   case AMDGPUFunctionArgInfo::WORKITEM_ID_X:
     118         585 :     return std::make_pair(WorkItemIDX ? &WorkItemIDX : nullptr,
     119             :                           &AMDGPU::VGPR_32RegClass);
     120         580 :   case AMDGPUFunctionArgInfo::WORKITEM_ID_Y:
     121         580 :     return std::make_pair(WorkItemIDY ? &WorkItemIDY : nullptr,
     122             :                           &AMDGPU::VGPR_32RegClass);
     123         580 :   case AMDGPUFunctionArgInfo::WORKITEM_ID_Z:
     124         580 :     return std::make_pair(WorkItemIDZ ? &WorkItemIDZ : nullptr,
     125             :                           &AMDGPU::VGPR_32RegClass);
     126             :   }
     127           0 :   llvm_unreachable("unexpected preloaded value type");
     128             : }

Generated by: LCOV version 1.13