mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[NVPTX] Remove old CONST_NOT_GEN address space that is not being used anymore and causes constants to be emitted in the global address space
llvm-svn: 183652
This commit is contained in:
parent
5f79506fd3
commit
fa2e2511f8
@ -22,7 +22,6 @@ namespace llvm {
|
||||
enum AddressSpace {
|
||||
ADDRESS_SPACE_GENERIC = 0,
|
||||
ADDRESS_SPACE_GLOBAL = 1,
|
||||
ADDRESS_SPACE_CONST_NOT_GEN = 2, // Not part of generic space
|
||||
ADDRESS_SPACE_SHARED = 3,
|
||||
ADDRESS_SPACE_CONST = 4,
|
||||
ADDRESS_SPACE_LOCAL = 5,
|
||||
|
@ -1224,7 +1224,6 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
||||
// Ptx allows variable initilization only for constant and global state
|
||||
// spaces.
|
||||
if (((PTy->getAddressSpace() == llvm::ADDRESS_SPACE_GLOBAL) ||
|
||||
(PTy->getAddressSpace() == llvm::ADDRESS_SPACE_CONST_NOT_GEN) ||
|
||||
(PTy->getAddressSpace() == llvm::ADDRESS_SPACE_CONST)) &&
|
||||
GVar->hasInitializer()) {
|
||||
const Constant *Initializer = GVar->getInitializer();
|
||||
@ -1248,7 +1247,6 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
||||
// Ptx allows variable initilization only for constant and
|
||||
// global state spaces.
|
||||
if (((PTy->getAddressSpace() == llvm::ADDRESS_SPACE_GLOBAL) ||
|
||||
(PTy->getAddressSpace() == llvm::ADDRESS_SPACE_CONST_NOT_GEN) ||
|
||||
(PTy->getAddressSpace() == llvm::ADDRESS_SPACE_CONST)) &&
|
||||
GVar->hasInitializer()) {
|
||||
const Constant *Initializer = GVar->getInitializer();
|
||||
@ -1319,14 +1317,6 @@ void NVPTXAsmPrinter::emitPTXAddressSpace(unsigned int AddressSpace,
|
||||
O << "global";
|
||||
break;
|
||||
case llvm::ADDRESS_SPACE_CONST:
|
||||
// This logic should be consistent with that in
|
||||
// getCodeAddrSpace() (NVPTXISelDATToDAT.cpp)
|
||||
if (nvptxSubtarget.hasGenericLdSt())
|
||||
O << "global";
|
||||
else
|
||||
O << "const";
|
||||
break;
|
||||
case llvm::ADDRESS_SPACE_CONST_NOT_GEN:
|
||||
O << "const";
|
||||
break;
|
||||
case llvm::ADDRESS_SPACE_SHARED:
|
||||
@ -1566,14 +1556,13 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
|
||||
default:
|
||||
O << ".ptr ";
|
||||
break;
|
||||
case llvm::ADDRESS_SPACE_CONST_NOT_GEN:
|
||||
case llvm::ADDRESS_SPACE_CONST:
|
||||
O << ".ptr .const ";
|
||||
break;
|
||||
case llvm::ADDRESS_SPACE_SHARED:
|
||||
O << ".ptr .shared ";
|
||||
break;
|
||||
case llvm::ADDRESS_SPACE_GLOBAL:
|
||||
case llvm::ADDRESS_SPACE_CONST:
|
||||
O << ".ptr .global ";
|
||||
break;
|
||||
}
|
||||
|
@ -127,38 +127,22 @@ SDNode *NVPTXDAGToDAGISel::Select(SDNode *N) {
|
||||
static unsigned int getCodeAddrSpace(MemSDNode *N,
|
||||
const NVPTXSubtarget &Subtarget) {
|
||||
const Value *Src = N->getSrcValue();
|
||||
|
||||
if (!Src)
|
||||
return NVPTX::PTXLdStInstCode::LOCAL;
|
||||
return NVPTX::PTXLdStInstCode::GENERIC;
|
||||
|
||||
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) {
|
||||
switch (PT->getAddressSpace()) {
|
||||
case llvm::ADDRESS_SPACE_LOCAL:
|
||||
return NVPTX::PTXLdStInstCode::LOCAL;
|
||||
case llvm::ADDRESS_SPACE_GLOBAL:
|
||||
return NVPTX::PTXLdStInstCode::GLOBAL;
|
||||
case llvm::ADDRESS_SPACE_SHARED:
|
||||
return NVPTX::PTXLdStInstCode::SHARED;
|
||||
case llvm::ADDRESS_SPACE_CONST_NOT_GEN:
|
||||
return NVPTX::PTXLdStInstCode::CONSTANT;
|
||||
case llvm::ADDRESS_SPACE_GENERIC:
|
||||
return NVPTX::PTXLdStInstCode::GENERIC;
|
||||
case llvm::ADDRESS_SPACE_PARAM:
|
||||
return NVPTX::PTXLdStInstCode::PARAM;
|
||||
case llvm::ADDRESS_SPACE_CONST:
|
||||
// If the arch supports generic address space, translate it to GLOBAL
|
||||
// for correctness.
|
||||
// If the arch does not support generic address space, then the arch
|
||||
// does not really support ADDRESS_SPACE_CONST, translate it to
|
||||
// to CONSTANT for better performance.
|
||||
if (Subtarget.hasGenericLdSt())
|
||||
return NVPTX::PTXLdStInstCode::GLOBAL;
|
||||
else
|
||||
return NVPTX::PTXLdStInstCode::CONSTANT;
|
||||
default:
|
||||
break;
|
||||
case llvm::ADDRESS_SPACE_LOCAL: return NVPTX::PTXLdStInstCode::LOCAL;
|
||||
case llvm::ADDRESS_SPACE_GLOBAL: return NVPTX::PTXLdStInstCode::GLOBAL;
|
||||
case llvm::ADDRESS_SPACE_SHARED: return NVPTX::PTXLdStInstCode::SHARED;
|
||||
case llvm::ADDRESS_SPACE_GENERIC: return NVPTX::PTXLdStInstCode::GENERIC;
|
||||
case llvm::ADDRESS_SPACE_PARAM: return NVPTX::PTXLdStInstCode::PARAM;
|
||||
case llvm::ADDRESS_SPACE_CONST: return NVPTX::PTXLdStInstCode::CONSTANT;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return NVPTX::PTXLdStInstCode::LOCAL;
|
||||
return NVPTX::PTXLdStInstCode::GENERIC;
|
||||
}
|
||||
|
||||
SDNode *NVPTXDAGToDAGISel::SelectLoad(SDNode *N) {
|
||||
|
10
test/CodeGen/NVPTX/pr16278.ll
Normal file
10
test/CodeGen/NVPTX/pr16278.ll
Normal file
@ -0,0 +1,10 @@
|
||||
; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
|
||||
|
||||
|
||||
@one_f = addrspace(4) global float 1.000000e+00, align 4
|
||||
|
||||
define float @foo() {
|
||||
; CHECK: ld.const.f32
|
||||
%val = load float addrspace(4)* @one_f
|
||||
ret float %val
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user