static unsigned int getCodeAddrSpace(MemSDNode *N, const NVPTXSubtarget &Subtarget) { const Value *Src = N->getSrcValue(); if (!Src) return NVPTX::PTXLdStInstCode::LOCAL; 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; } } return NVPTX::PTXLdStInstCode::LOCAL; }
static std::string computeDataLayout(const NVPTXSubtarget &ST) { std::string Ret = "e"; if (!ST.is64Bit()) Ret += "-p:32:32"; Ret += "-i64:64-v16:16-v32:32-n16:32:64"; return Ret; }
NVPTXRegisterInfo::NVPTXRegisterInfo(const NVPTXSubtarget &st) : NVPTXGenRegisterInfo(0), Is64Bit(st.is64Bit()) {}
NVPTXFrameLowering::NVPTXFrameLowering(NVPTXSubtarget &STI) : TargetFrameLowering(TargetFrameLowering::StackGrowsUp, 8, 0), is64bit(STI.is64Bit()) {}