LCOV - code coverage report
Current view: top level - lib/Target/AMDGPU - AMDGPUMachineFunction.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 25 25 100.0 %
Date: 2018-09-23 13:06:45 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- AMDGPUMachineFunctionInfo.cpp ---------------------------------------=//
       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 "AMDGPUMachineFunction.h"
      11             : #include "AMDGPUSubtarget.h"
      12             : #include "AMDGPUPerfHintAnalysis.h"
      13             : #include "llvm/CodeGen/MachineModuleInfo.h"
      14             : 
      15             : using namespace llvm;
      16             : 
      17       22645 : AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
      18             :   MachineFunctionInfo(),
      19             :   LocalMemoryObjects(),
      20             :   ExplicitKernArgSize(0),
      21             :   MaxKernArgAlign(0),
      22             :   LDSSize(0),
      23       45290 :   IsEntryFunction(AMDGPU::isEntryFunctionCC(MF.getFunction().getCallingConv())),
      24       22645 :   NoSignedZerosFPMath(MF.getTarget().Options.NoSignedZerosFPMath),
      25             :   MemoryBound(false),
      26       22645 :   WaveLimiter(false) {
      27       22645 :   const AMDGPUSubtarget &ST = AMDGPUSubtarget::get(MF);
      28             : 
      29             :   // FIXME: Should initialize KernArgSize based on ExplicitKernelArgOffset,
      30             :   // except reserved size is not correctly aligned.
      31       22645 :   const Function &F = MF.getFunction();
      32             : 
      33       22645 :   if (auto *Resolver = MF.getMMI().getResolver()) {
      34       22626 :     if (AMDGPUPerfHintAnalysis *PHA = static_cast<AMDGPUPerfHintAnalysis*>(
      35       22626 :           Resolver->getAnalysisIfAvailable(&AMDGPUPerfHintAnalysisID, true))) {
      36       21514 :       MemoryBound = PHA->isMemoryBound(&F);
      37       21514 :       WaveLimiter = PHA->needsWaveLimiter(&F);
      38             :     }
      39             :   }
      40             : 
      41             :   CallingConv::ID CC = F.getCallingConv();
      42       22645 :   if (CC == CallingConv::AMDGPU_KERNEL || CC == CallingConv::SPIR_KERNEL)
      43       18357 :     ExplicitKernArgSize = ST.getExplicitKernArgSize(F, MaxKernArgAlign);
      44       22645 : }
      45             : 
      46         396 : unsigned AMDGPUMachineFunction::allocateLDSGlobal(const DataLayout &DL,
      47             :                                                   const GlobalValue &GV) {
      48         396 :   auto Entry = LocalMemoryObjects.insert(std::make_pair(&GV, 0));
      49         396 :   if (!Entry.second)
      50           7 :     return Entry.first->second;
      51             : 
      52         389 :   unsigned Align = GV.getAlignment();
      53         389 :   if (Align == 0)
      54          73 :     Align = DL.getABITypeAlignment(GV.getValueType());
      55             : 
      56             :   /// TODO: We should sort these to minimize wasted space due to alignment
      57             :   /// padding. Currently the padding is decided by the first encountered use
      58             :   /// during lowering.
      59         389 :   unsigned Offset = LDSSize = alignTo(LDSSize, Align);
      60             : 
      61         389 :   Entry.first->second = Offset;
      62         389 :   LDSSize += DL.getTypeAllocSize(GV.getValueType());
      63             : 
      64         389 :   return Offset;
      65             : }

Generated by: LCOV version 1.13