#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/Analysis/CycleAnalysis.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/IR/IntrinsicsR600.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/IPO/Attributor.h"
#define DEBUG_TYPE …
namespace llvm {
void initializeCycleInfoWrapperPassPass(PassRegistry &);
}
usingnamespacellvm;
static cl::opt<unsigned> KernargPreloadCount(
"amdgpu-kernarg-preload-count",
cl::desc("How many kernel arguments to preload onto SGPRs"), cl::init(0));
static cl::opt<unsigned> IndirectCallSpecializationThreshold(
"amdgpu-indirect-call-specialization-threshold",
cl::desc(
"A threshold controls whether an indirect call will be specialized"),
cl::init(3));
#define AMDGPU_ATTRIBUTE …
enum ImplicitArgumentPositions { … };
#define AMDGPU_ATTRIBUTE …
enum ImplicitArgumentMask { … };
#define AMDGPU_ATTRIBUTE …
static constexpr std::pair<ImplicitArgumentMask,
StringLiteral> ImplicitAttrs[] = …;
static ImplicitArgumentMask
intrinsicToAttrMask(Intrinsic::ID ID, bool &NonKernelOnly, bool &NeedsImplicit,
bool HasApertureRegs, bool SupportsGetDoorBellID,
unsigned CodeObjectVersion) { … }
static bool castRequiresQueuePtr(unsigned SrcAS) { … }
static bool isDSAddress(const Constant *C) { … }
static bool funcRequiresHostcallPtr(const Function &F) { … }
namespace {
class AMDGPUInformationCache : public InformationCache { … };
struct AAAMDAttributes
: public StateWrapper<BitIntegerState<uint32_t, ALL_ARGUMENT_MASK, 0>,
AbstractAttribute> { … };
const char AAAMDAttributes::ID = …;
struct AAUniformWorkGroupSize
: public StateWrapper<BooleanState, AbstractAttribute> { … };
const char AAUniformWorkGroupSize::ID = …;
struct AAUniformWorkGroupSizeFunction : public AAUniformWorkGroupSize { … };
AAUniformWorkGroupSize &
AAUniformWorkGroupSize::createForPosition(const IRPosition &IRP,
Attributor &A) { … }
struct AAAMDAttributesFunction : public AAAMDAttributes { … };
AAAMDAttributes &AAAMDAttributes::createForPosition(const IRPosition &IRP,
Attributor &A) { … }
struct AAAMDSizeRangeAttribute
: public StateWrapper<IntegerRangeState, AbstractAttribute, uint32_t> { … };
struct AAAMDFlatWorkGroupSize : public AAAMDSizeRangeAttribute { … };
const char AAAMDFlatWorkGroupSize::ID = …;
AAAMDFlatWorkGroupSize &
AAAMDFlatWorkGroupSize::createForPosition(const IRPosition &IRP,
Attributor &A) { … }
struct AAAMDWavesPerEU : public AAAMDSizeRangeAttribute { … };
const char AAAMDWavesPerEU::ID = …;
AAAMDWavesPerEU &AAAMDWavesPerEU::createForPosition(const IRPosition &IRP,
Attributor &A) { … }
static bool inlineAsmUsesAGPRs(const InlineAsm *IA) { … }
struct AAAMDGPUNoAGPR
: public IRAttribute<Attribute::NoUnwind,
StateWrapper<BooleanState, AbstractAttribute>,
AAAMDGPUNoAGPR> { … };
const char AAAMDGPUNoAGPR::ID = …;
static void addPreloadKernArgHint(Function &F, TargetMachine &TM) { … }
static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
AMDGPUAttributorOptions Options) { … }
class AMDGPUAttributorLegacy : public ModulePass { … };
}
PreservedAnalyses llvm::AMDGPUAttributorPass::run(Module &M,
ModuleAnalysisManager &AM) { … }
char AMDGPUAttributorLegacy::ID = …;
Pass *llvm::createAMDGPUAttributorLegacyPass() { … }
INITIALIZE_PASS_BEGIN(AMDGPUAttributorLegacy, DEBUG_TYPE, "AMDGPU Attributor",
false, false)
INITIALIZE_PASS_DEPENDENCY(CycleInfoWrapperPass);
INITIALIZE_PASS_END(AMDGPUAttributorLegacy, DEBUG_TYPE, "AMDGPU Attributor",
false, false)