LLVM  6.0.0svn
AMDGPUMachineFunction.cpp
Go to the documentation of this file.
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 
13 using namespace llvm;
14 
17  LocalMemoryObjects(),
18  KernArgSize(0),
19  MaxKernArgAlign(0),
20  LDSSize(0),
21  ABIArgOffset(0),
22  IsEntryFunction(AMDGPU::isEntryFunctionCC(MF.getFunction()->getCallingConv())),
23  NoSignedZerosFPMath(MF.getTarget().Options.NoSignedZerosFPMath) {
24  // FIXME: Should initialize KernArgSize based on ExplicitKernelArgOffset,
25  // except reserved size is not correctly aligned.
26 }
27 
29  const GlobalValue &GV) {
30  auto Entry = LocalMemoryObjects.insert(std::make_pair(&GV, 0));
31  if (!Entry.second)
32  return Entry.first->second;
33 
34  unsigned Align = GV.getAlignment();
35  if (Align == 0)
36  Align = DL.getABITypeAlignment(GV.getValueType());
37 
38  /// TODO: We should sort these to minimize wasted space due to alignment
39  /// padding. Currently the padding is decided by the first encountered use
40  /// during lowering.
41  unsigned Offset = LDSSize = alignTo(LDSSize, Align);
42 
43  Entry.first->second = Offset;
44  LDSSize += DL.getTypeAllocSize(GV.getValueType());
45 
46  return Offset;
47 }
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:109
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV)
AMDGPU specific subclass of TargetSubtarget.
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
AMDGPUMachineFunction(const MachineFunction &MF)
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
Definition: MathExtras.h:677
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
unsigned getAlignment() const
Definition: Globals.cpp:97
bool isEntryFunctionCC(CallingConv::ID CC)
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
Definition: DataLayout.cpp:682
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Definition: DataLayout.h:403
Type * getValueType() const
Definition: GlobalValue.h:267