LCOV - code coverage report
Current view: top level - lib/Target/AMDGPU - AMDGPUArgumentUsageInfo.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 55 88 62.5 %
Date: 2017-09-14 15:23:50 Functions: 6 8 75.0 %
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      471664 : 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       72306 : const AMDGPUFunctionArgInfo AMDGPUArgumentUsageInfo::ExternFunctionInfo{};
      38             : 
      39        1701 : bool AMDGPUArgumentUsageInfo::doInitialization(Module &M) {
      40        1701 :   return false;
      41             : }
      42             : 
      43        1692 : bool AMDGPUArgumentUsageInfo::doFinalization(Module &M) {
      44        1692 :   ArgInfoMap.clear();
      45        1692 :   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 :        << "  GridWorkgroupCountX: " << FI.second.GridWorkGroupCountX
      59           0 :        << "  GridWorkgroupCountY: " << FI.second.GridWorkGroupCountY
      60           0 :        << "  GridWorkgroupCountZ: " << FI.second.GridWorkGroupCountZ
      61           0 :        << "  WorkGroupIDX: " << FI.second.WorkGroupIDX
      62           0 :        << "  WorkGroupIDY: " << FI.second.WorkGroupIDY
      63           0 :        << "  WorkGroupIDZ: " << FI.second.WorkGroupIDZ
      64           0 :        << "  WorkGroupInfo: " << FI.second.WorkGroupInfo
      65             :        << "  PrivateSegmentWaveByteOffset: "
      66           0 :           << FI.second.PrivateSegmentWaveByteOffset
      67           0 :        << "  ImplicitBufferPtr: " << FI.second.ImplicitBufferPtr
      68           0 :        << "  ImplicitArgPtr: " << FI.second.ImplicitArgPtr
      69           0 :        << "  WorkItemIDX " << FI.second.WorkItemIDX
      70           0 :        << "  WorkItemIDY " << FI.second.WorkItemIDY
      71           0 :        << "  WorkItemIDZ " << FI.second.WorkItemIDZ
      72           0 :        << '\n';
      73             :   }
      74           0 : }
      75             : 
      76             : std::pair<const ArgDescriptor *, const TargetRegisterClass *>
      77       39942 : AMDGPUFunctionArgInfo::getPreloadedValue(
      78             :   AMDGPUFunctionArgInfo::PreloadedValue Value) const {
      79       39942 :   switch (Value) {
      80         820 :   case AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_BUFFER: {
      81             :     return std::make_pair(
      82        1640 :       PrivateSegmentBuffer ? &PrivateSegmentBuffer : nullptr,
      83         820 :       &AMDGPU::SGPR_128RegClass);
      84             :   }
      85           2 :   case AMDGPUFunctionArgInfo::IMPLICIT_BUFFER_PTR:
      86           4 :     return std::make_pair(ImplicitBufferPtr ? &ImplicitBufferPtr : nullptr,
      87           2 :                           &AMDGPU::SGPR_64RegClass);
      88         510 :   case AMDGPUFunctionArgInfo::WORKGROUP_ID_X:
      89        1020 :     return std::make_pair(WorkGroupIDX ? &WorkGroupIDX : nullptr,
      90         510 :                           &AMDGPU::SGPR_32RegClass);
      91             : 
      92         493 :   case AMDGPUFunctionArgInfo::WORKGROUP_ID_Y:
      93         986 :     return std::make_pair(WorkGroupIDY ? &WorkGroupIDY : nullptr,
      94         493 :                           &AMDGPU::SGPR_32RegClass);
      95         493 :   case AMDGPUFunctionArgInfo::WORKGROUP_ID_Z:
      96         986 :     return std::make_pair(WorkGroupIDZ ? &WorkGroupIDZ : nullptr,
      97         493 :                           &AMDGPU::SGPR_32RegClass);
      98        1330 :   case AMDGPUFunctionArgInfo::PRIVATE_SEGMENT_WAVE_BYTE_OFFSET:
      99             :     return std::make_pair(
     100        2660 :       PrivateSegmentWaveByteOffset ? &PrivateSegmentWaveByteOffset : nullptr,
     101        1330 :       &AMDGPU::SGPR_32RegClass);
     102       32717 :   case AMDGPUFunctionArgInfo::KERNARG_SEGMENT_PTR:
     103       65434 :     return std::make_pair(KernargSegmentPtr ? &KernargSegmentPtr : nullptr,
     104       32717 :                           &AMDGPU::SGPR_64RegClass);
     105         467 :   case AMDGPUFunctionArgInfo::IMPLICIT_ARG_PTR:
     106         934 :     return std::make_pair(ImplicitArgPtr ? &ImplicitArgPtr : nullptr,
     107         467 :                           &AMDGPU::SGPR_64RegClass);
     108         464 :   case AMDGPUFunctionArgInfo::DISPATCH_ID:
     109         928 :     return std::make_pair(DispatchID ? &DispatchID : nullptr,
     110         464 :                           &AMDGPU::SGPR_64RegClass);
     111         332 :   case AMDGPUFunctionArgInfo::FLAT_SCRATCH_INIT:
     112         664 :     return std::make_pair(FlatScratchInit ? &FlatScratchInit : nullptr,
     113         332 :                           &AMDGPU::SGPR_64RegClass);
     114         482 :   case AMDGPUFunctionArgInfo::DISPATCH_PTR:
     115         964 :     return std::make_pair(DispatchPtr ? &DispatchPtr : nullptr,
     116         482 :                           &AMDGPU::SGPR_64RegClass);
     117         465 :   case AMDGPUFunctionArgInfo::QUEUE_PTR:
     118         930 :     return std::make_pair(QueuePtr ? &QueuePtr : nullptr,
     119         465 :                           &AMDGPU::SGPR_64RegClass);
     120         459 :   case AMDGPUFunctionArgInfo::WORKITEM_ID_X:
     121         918 :     return std::make_pair(WorkItemIDX ? &WorkItemIDX : nullptr,
     122         459 :                           &AMDGPU::VGPR_32RegClass);
     123         454 :   case AMDGPUFunctionArgInfo::WORKITEM_ID_Y:
     124         908 :     return std::make_pair(WorkItemIDY ? &WorkItemIDY : nullptr,
     125         454 :                           &AMDGPU::VGPR_32RegClass);
     126         454 :   case AMDGPUFunctionArgInfo::WORKITEM_ID_Z:
     127         908 :     return std::make_pair(WorkItemIDZ ? &WorkItemIDZ : nullptr,
     128         454 :                           &AMDGPU::VGPR_32RegClass);
     129             :   }
     130           0 :   llvm_unreachable("unexpected preloaded value type");
     131      144612 : }

Generated by: LCOV version 1.13