diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index 5a1d1a55795b..ae4890a614df 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -226,7 +226,7 @@ void AMDGPUAsmPrinter::EmitFunctionEntryLabel() { void AMDGPUAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { // Group segment variables aren't emitted in HSA. - if (AMDGPU::isGroupSegment(GV, AMDGPUASI)) + if (AMDGPU::isGroupSegment(GV)) return; AsmPrinter::EmitGlobalVariable(GV); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp index 04e2829c76b6..bb65636f15af 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp @@ -91,7 +91,6 @@ static void collectCallers(Function *F, DenseSet &Callers) { bool AMDGPUOpenCLEnqueuedBlockLowering::runOnModule(Module &M) { DenseSet Callers; auto &C = M.getContext(); - auto AS = AMDGPU::getAMDGPUAS(M); bool Changed = false; for (auto &F : M.functions()) { if (F.hasFnAttribute("enqueued-block")) { @@ -104,10 +103,10 @@ bool AMDGPUOpenCLEnqueuedBlockLowering::runOnModule(Module &M) { auto *AddrCast = cast(*BitCast->user_begin()); auto RuntimeHandle = (F.getName() + "_runtime_handle").str(); auto *GV = new GlobalVariable( - M, Type::getInt8Ty(C)->getPointerTo(AS.GLOBAL_ADDRESS), + M, Type::getInt8Ty(C)->getPointerTo(AMDGPUAS::GLOBAL_ADDRESS), /*IsConstant=*/true, GlobalValue::ExternalLinkage, /*Initializer=*/nullptr, RuntimeHandle, /*InsertBefore=*/nullptr, - GlobalValue::NotThreadLocal, AS.GLOBAL_ADDRESS, + GlobalValue::NotThreadLocal, AMDGPUAS::GLOBAL_ADDRESS, /*IsExternallyInitialized=*/true); DEBUG(dbgs() << "runtime handle created: " << *GV << '\n'); auto *NewPtr = ConstantExpr::getPointerCast(GV, AddrCast->getType()); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp index 6c1885e67fcb..e2f718bd3c34 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp @@ -23,8 +23,7 @@ using namespace llvm; MCSection *AMDGPUTargetObjectFile::SelectSectionForGlobal( const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { - auto AS = static_cast(&TM)->getAMDGPUAS(); - if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GO, AS) && + if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GO) && AMDGPU::shouldEmitConstantsToTextSection(TM.getTargetTriple())) return TextSection; diff --git a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp index 69a63b6941ef..2c60c267f937 100644 --- a/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -1308,39 +1308,39 @@ SDValue R600TargetLowering::LowerSTORE(SDValue Op, SelectionDAG &DAG) const { // return (512 + (kc_bank << 12) static int -ConstantAddressBlock(unsigned AddressSpace, AMDGPUAS AMDGPUASI) { +ConstantAddressBlock(unsigned AddressSpace) { switch (AddressSpace) { - case AMDGPUASI.CONSTANT_BUFFER_0: + case AMDGPUAS::CONSTANT_BUFFER_0: return 512; - case AMDGPUASI.CONSTANT_BUFFER_1: + case AMDGPUAS::CONSTANT_BUFFER_1: return 512 + 4096; - case AMDGPUASI.CONSTANT_BUFFER_2: + case AMDGPUAS::CONSTANT_BUFFER_2: return 512 + 4096 * 2; - case AMDGPUASI.CONSTANT_BUFFER_3: + case AMDGPUAS::CONSTANT_BUFFER_3: return 512 + 4096 * 3; - case AMDGPUASI.CONSTANT_BUFFER_4: + case AMDGPUAS::CONSTANT_BUFFER_4: return 512 + 4096 * 4; - case AMDGPUASI.CONSTANT_BUFFER_5: + case AMDGPUAS::CONSTANT_BUFFER_5: return 512 + 4096 * 5; - case AMDGPUASI.CONSTANT_BUFFER_6: + case AMDGPUAS::CONSTANT_BUFFER_6: return 512 + 4096 * 6; - case AMDGPUASI.CONSTANT_BUFFER_7: + case AMDGPUAS::CONSTANT_BUFFER_7: return 512 + 4096 * 7; - case AMDGPUASI.CONSTANT_BUFFER_8: + case AMDGPUAS::CONSTANT_BUFFER_8: return 512 + 4096 * 8; - case AMDGPUASI.CONSTANT_BUFFER_9: + case AMDGPUAS::CONSTANT_BUFFER_9: return 512 + 4096 * 9; - case AMDGPUASI.CONSTANT_BUFFER_10: + case AMDGPUAS::CONSTANT_BUFFER_10: return 512 + 4096 * 10; - case AMDGPUASI.CONSTANT_BUFFER_11: + case AMDGPUAS::CONSTANT_BUFFER_11: return 512 + 4096 * 11; - case AMDGPUASI.CONSTANT_BUFFER_12: + case AMDGPUAS::CONSTANT_BUFFER_12: return 512 + 4096 * 12; - case AMDGPUASI.CONSTANT_BUFFER_13: + case AMDGPUAS::CONSTANT_BUFFER_13: return 512 + 4096 * 13; - case AMDGPUASI.CONSTANT_BUFFER_14: + case AMDGPUAS::CONSTANT_BUFFER_14: return 512 + 4096 * 14; - case AMDGPUASI.CONSTANT_BUFFER_15: + case AMDGPUAS::CONSTANT_BUFFER_15: return 512 + 4096 * 15; default: return -1; @@ -1424,8 +1424,7 @@ SDValue R600TargetLowering::LowerLOAD(SDValue Op, SelectionDAG &DAG) const { return scalarizeVectorLoad(LoadNode, DAG); } - int ConstantBlock = ConstantAddressBlock(LoadNode->getAddressSpace(), - AMDGPUASI); + int ConstantBlock = ConstantAddressBlock(LoadNode->getAddressSpace()); if (ConstantBlock > -1 && ((LoadNode->getExtensionType() == ISD::NON_EXTLOAD) || (LoadNode->getExtensionType() == ISD::ZEXTLOAD))) { diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp index 37f5665be507..08a7419612bd 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp @@ -369,7 +369,6 @@ void SIFrameLowering::emitEntryFunctionScratchSetup(const SISubtarget &ST, const SIInstrInfo *TII = ST.getInstrInfo(); const SIRegisterInfo *TRI = &TII->getRegisterInfo(); DebugLoc DL; - auto AMDGPUASI = ST.getAMDGPUAS(); if (ST.isAmdPalOS()) { // The pointer to the GIT is formed from the offset passed in and either @@ -437,7 +436,7 @@ void SIFrameLowering::emitEntryFunctionScratchSetup(const SISubtarget &ST, PointerType *PtrTy = PointerType::get(Type::getInt64Ty(MF.getFunction()->getContext()), - AMDGPUASI.CONSTANT_ADDRESS); + AMDGPUAS::CONSTANT_ADDRESS); MachinePointerInfo PtrInfo(UndefValue::get(PtrTy)); auto MMO = MF.getMachineMemOperand(PtrInfo, MachineMemOperand::MOLoad | diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp index ae70dd2893c8..15fdbc2d1e4c 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp @@ -356,16 +356,16 @@ void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header, Header.private_segment_alignment = 4; } -bool isGroupSegment(const GlobalValue *GV, AMDGPUAS AS) { - return GV->getType()->getAddressSpace() == AS.LOCAL_ADDRESS; +bool isGroupSegment(const GlobalValue *GV) { + return GV->getType()->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS; } -bool isGlobalSegment(const GlobalValue *GV, AMDGPUAS AS) { - return GV->getType()->getAddressSpace() == AS.GLOBAL_ADDRESS; +bool isGlobalSegment(const GlobalValue *GV) { + return GV->getType()->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS; } -bool isReadOnlySegment(const GlobalValue *GV, AMDGPUAS AS) { - return GV->getType()->getAddressSpace() == AS.CONSTANT_ADDRESS; +bool isReadOnlySegment(const GlobalValue *GV) { + return GV->getType()->getAddressSpace() == AMDGPUAS::CONSTANT_ADDRESS; } bool shouldEmitConstantsToTextSection(const Triple &TT) { diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h index 60a7af837fb1..c4b7779514f0 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h @@ -159,9 +159,9 @@ int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx); void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header, const FeatureBitset &Features); -bool isGroupSegment(const GlobalValue *GV, AMDGPUAS AS); -bool isGlobalSegment(const GlobalValue *GV, AMDGPUAS AS); -bool isReadOnlySegment(const GlobalValue *GV, AMDGPUAS AS); +bool isGroupSegment(const GlobalValue *GV); +bool isGlobalSegment(const GlobalValue *GV); +bool isReadOnlySegment(const GlobalValue *GV); /// \returns True if constants should be emitted to .text section for given /// target triple \p TT, false otherwise.