mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-05 11:27:41 +00:00
Remove all use of getDrvInterface off of NVPTXSubtarget and clean
up code accordingly. Delete code that was checking for all cases of an enum. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229786 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9d2ea22e2b
commit
c72978539d
@ -164,7 +164,7 @@ void NVPTXAsmPrinter::emitLineNumberAsDotLoc(const MachineInstr &MI) {
|
|||||||
void NVPTXAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
void NVPTXAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||||
SmallString<128> Str;
|
SmallString<128> Str;
|
||||||
raw_svector_ostream OS(Str);
|
raw_svector_ostream OS(Str);
|
||||||
if (nvptxSubtarget->getDrvInterface() == NVPTX::CUDA)
|
if (static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() == NVPTX::CUDA)
|
||||||
emitLineNumberAsDotLoc(*MI);
|
emitLineNumberAsDotLoc(*MI);
|
||||||
|
|
||||||
MCInst Inst;
|
MCInst Inst;
|
||||||
@ -908,9 +908,10 @@ void NVPTXAsmPrinter::emitHeader(Module &M, raw_ostream &O,
|
|||||||
O << ".target ";
|
O << ".target ";
|
||||||
O << STI.getTargetName();
|
O << STI.getTargetName();
|
||||||
|
|
||||||
if (STI.getDrvInterface() == NVPTX::NVCL)
|
const NVPTXTargetMachine &TM = static_cast<const NVPTXTargetMachine &>(TM);
|
||||||
|
if (TM.getDrvInterface() == NVPTX::NVCL)
|
||||||
O << ", texmode_independent";
|
O << ", texmode_independent";
|
||||||
if (STI.getDrvInterface() == NVPTX::CUDA) {
|
else {
|
||||||
if (!STI.hasDouble())
|
if (!STI.hasDouble())
|
||||||
O << ", map_f64_to_f32";
|
O << ", map_f64_to_f32";
|
||||||
}
|
}
|
||||||
@ -921,7 +922,7 @@ void NVPTXAsmPrinter::emitHeader(Module &M, raw_ostream &O,
|
|||||||
O << "\n";
|
O << "\n";
|
||||||
|
|
||||||
O << ".address_size ";
|
O << ".address_size ";
|
||||||
if (static_cast<const NVPTXTargetMachine &>(TM).is64Bit())
|
if (TM.is64Bit())
|
||||||
O << "64";
|
O << "64";
|
||||||
else
|
else
|
||||||
O << "32";
|
O << "32";
|
||||||
@ -992,7 +993,7 @@ bool NVPTXAsmPrinter::doFinalization(Module &M) {
|
|||||||
|
|
||||||
void NVPTXAsmPrinter::emitLinkageDirective(const GlobalValue *V,
|
void NVPTXAsmPrinter::emitLinkageDirective(const GlobalValue *V,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
if (nvptxSubtarget->getDrvInterface() == NVPTX::CUDA) {
|
if (static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() == NVPTX::CUDA) {
|
||||||
if (V->hasExternalLinkage()) {
|
if (V->hasExternalLinkage()) {
|
||||||
if (isa<GlobalVariable>(V)) {
|
if (isa<GlobalVariable>(V)) {
|
||||||
const GlobalVariable *GVar = cast<GlobalVariable>(V);
|
const GlobalVariable *GVar = cast<GlobalVariable>(V);
|
||||||
@ -1413,39 +1414,11 @@ static unsigned int getOpenCLAlignment(const DataLayout *TD, Type *Ty) {
|
|||||||
|
|
||||||
void NVPTXAsmPrinter::printParamName(Function::const_arg_iterator I,
|
void NVPTXAsmPrinter::printParamName(Function::const_arg_iterator I,
|
||||||
int paramIndex, raw_ostream &O) {
|
int paramIndex, raw_ostream &O) {
|
||||||
if ((nvptxSubtarget->getDrvInterface() == NVPTX::NVCL) ||
|
O << *getSymbol(I->getParent()) << "_param_" << paramIndex;
|
||||||
(nvptxSubtarget->getDrvInterface() == NVPTX::CUDA))
|
|
||||||
O << *getSymbol(I->getParent()) << "_param_" << paramIndex;
|
|
||||||
else {
|
|
||||||
std::string argName = I->getName();
|
|
||||||
const char *p = argName.c_str();
|
|
||||||
while (*p) {
|
|
||||||
if (*p == '.')
|
|
||||||
O << "_";
|
|
||||||
else
|
|
||||||
O << *p;
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NVPTXAsmPrinter::printParamName(int paramIndex, raw_ostream &O) {
|
void NVPTXAsmPrinter::printParamName(int paramIndex, raw_ostream &O) {
|
||||||
Function::const_arg_iterator I, E;
|
O << *CurrentFnSym << "_param_" << paramIndex;
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if ((nvptxSubtarget->getDrvInterface() == NVPTX::NVCL) ||
|
|
||||||
(nvptxSubtarget->getDrvInterface() == NVPTX::CUDA)) {
|
|
||||||
O << *CurrentFnSym << "_param_" << paramIndex;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (I = F->arg_begin(), E = F->arg_end(); I != E; ++I, i++) {
|
|
||||||
if (i == paramIndex) {
|
|
||||||
printParamName(I, paramIndex, O);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
llvm_unreachable("paramIndex out of bound");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
|
void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
|
||||||
@ -1522,7 +1495,8 @@ void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
|
|||||||
// Special handling for pointer arguments to kernel
|
// Special handling for pointer arguments to kernel
|
||||||
O << "\t.param .u" << thePointerTy.getSizeInBits() << " ";
|
O << "\t.param .u" << thePointerTy.getSizeInBits() << " ";
|
||||||
|
|
||||||
if (nvptxSubtarget->getDrvInterface() != NVPTX::CUDA) {
|
if (static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() !=
|
||||||
|
NVPTX::CUDA) {
|
||||||
Type *ETy = PTy->getElementType();
|
Type *ETy = PTy->getElementType();
|
||||||
int addrSpace = PTy->getAddressSpace();
|
int addrSpace = PTy->getAddressSpace();
|
||||||
switch (addrSpace) {
|
switch (addrSpace) {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "NVPTX.h"
|
#include "NVPTX.h"
|
||||||
#include "NVPTXMachineFunctionInfo.h"
|
#include "NVPTXMachineFunctionInfo.h"
|
||||||
#include "NVPTXSubtarget.h"
|
#include "NVPTXSubtarget.h"
|
||||||
|
#include "NVPTXTargetMachine.h"
|
||||||
#include "llvm/ADT/DenseSet.h"
|
#include "llvm/ADT/DenseSet.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
@ -142,8 +143,9 @@ findIndexForHandle(MachineOperand &Op, MachineFunction &MF, unsigned &Idx) {
|
|||||||
case NVPTX::LD_i64_avar: {
|
case NVPTX::LD_i64_avar: {
|
||||||
// The handle is a parameter value being loaded, replace with the
|
// The handle is a parameter value being loaded, replace with the
|
||||||
// parameter symbol
|
// parameter symbol
|
||||||
const NVPTXSubtarget &ST = MF.getTarget().getSubtarget<NVPTXSubtarget>();
|
const NVPTXTargetMachine &TM =
|
||||||
if (ST.getDrvInterface() == NVPTX::CUDA) {
|
static_cast<const NVPTXTargetMachine &>(MF.getTarget());
|
||||||
|
if (TM.getDrvInterface() == NVPTX::CUDA) {
|
||||||
// For CUDA, we preserve the param loads coming from function arguments
|
// For CUDA, we preserve the param loads coming from function arguments
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,12 @@ NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU,
|
|||||||
InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
|
InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
|
||||||
TSInfo(TM.getDataLayout()), FrameLowering(*this) {}
|
TSInfo(TM.getDataLayout()), FrameLowering(*this) {}
|
||||||
|
|
||||||
NVPTX::DrvInterface NVPTXSubtarget::getDrvInterface() const {
|
bool NVPTXSubtarget::hasImageHandles() const {
|
||||||
return TM.getDrvInterface();
|
// Enable handles for Kepler+, where CUDA supports indirect surfaces and
|
||||||
|
// textures
|
||||||
|
if (TM.getDrvInterface() == NVPTX::CUDA)
|
||||||
|
return (SmVersion >= 30);
|
||||||
|
|
||||||
|
// Disabled, otherwise
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -94,20 +94,10 @@ public:
|
|||||||
}
|
}
|
||||||
inline bool hasROT32() const { return hasHWROT32() || hasSWROT32(); }
|
inline bool hasROT32() const { return hasHWROT32() || hasSWROT32(); }
|
||||||
inline bool hasROT64() const { return SmVersion >= 20; }
|
inline bool hasROT64() const { return SmVersion >= 20; }
|
||||||
|
bool hasImageHandles() const;
|
||||||
bool hasImageHandles() const {
|
|
||||||
// Enable handles for Kepler+, where CUDA supports indirect surfaces and
|
|
||||||
// textures
|
|
||||||
if (getDrvInterface() == NVPTX::CUDA)
|
|
||||||
return (SmVersion >= 30);
|
|
||||||
|
|
||||||
// Disabled, otherwise
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool is64Bit() const { return Is64Bit; }
|
bool is64Bit() const { return Is64Bit; }
|
||||||
|
|
||||||
unsigned int getSmVersion() const { return SmVersion; }
|
unsigned int getSmVersion() const { return SmVersion; }
|
||||||
NVPTX::DrvInterface getDrvInterface() const;
|
|
||||||
std::string getTargetName() const { return TargetName; }
|
std::string getTargetName() const { return TargetName; }
|
||||||
|
|
||||||
unsigned getPTXVersion() const { return PTXVersion; }
|
unsigned getPTXVersion() const { return PTXVersion; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user