Skip to content

Commit c5275bd

Browse files
committed
[NVPTX] Remove dead code.
I left helpers that look useful for debugging alone. NFC. llvm-svn: 250410
1 parent 33ef8ac commit c5275bd

File tree

9 files changed

+0
-222
lines changed

9 files changed

+0
-222
lines changed

llvm/lib/Target/NVPTX/NVPTX.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,6 @@ enum CondCodes {
4141
};
4242
}
4343

44-
inline static const char *NVPTXCondCodeToString(NVPTXCC::CondCodes CC) {
45-
switch (CC) {
46-
case NVPTXCC::NE:
47-
return "ne";
48-
case NVPTXCC::EQ:
49-
return "eq";
50-
case NVPTXCC::LT:
51-
return "lt";
52-
case NVPTXCC::LE:
53-
return "le";
54-
case NVPTXCC::GT:
55-
return "gt";
56-
case NVPTXCC::GE:
57-
return "ge";
58-
}
59-
llvm_unreachable("Unknown condition code");
60-
}
61-
6244
FunctionPass *createNVPTXISelDag(NVPTXTargetMachine &TM,
6345
llvm::CodeGenOpt::Level OptLevel);
6446
ModulePass *createNVPTXAssignValidGlobalNamesPass();

llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,11 +1419,6 @@ void NVPTXAsmPrinter::printParamName(Function::const_arg_iterator I,
14191419
O << "_param_" << paramIndex;
14201420
}
14211421

1422-
void NVPTXAsmPrinter::printParamName(int paramIndex, raw_ostream &O) {
1423-
CurrentFnSym->print(O, MAI);
1424-
O << "_param_" << paramIndex;
1425-
}
1426-
14271422
void NVPTXAsmPrinter::emitFunctionParamList(const Function *F, raw_ostream &O) {
14281423
const DataLayout &DL = getDataLayout();
14291424
const AttributeSet &PAL = F->getAttributes();
@@ -1951,15 +1946,6 @@ void NVPTXAsmPrinter::bufferAggregateConstant(const Constant *CPV,
19511946
// buildTypeNameMap - Run through symbol table looking for type names.
19521947
//
19531948

1954-
bool NVPTXAsmPrinter::isImageType(Type *Ty) {
1955-
1956-
std::map<Type *, std::string>::iterator PI = TypeNameMap.find(Ty);
1957-
1958-
return PI != TypeNameMap.end() && (!PI->second.compare("struct._image1d_t") ||
1959-
!PI->second.compare("struct._image2d_t") ||
1960-
!PI->second.compare("struct._image3d_t"));
1961-
}
1962-
19631949

19641950
bool NVPTXAsmPrinter::ignoreLoc(const MachineInstr &MI) {
19651951
switch (MI.getOpcode()) {

llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,28 +212,21 @@ class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
212212
MCOperand GetSymbolRef(const MCSymbol *Symbol);
213213
unsigned encodeVirtualRegister(unsigned Reg);
214214

215-
void EmitAlignment(unsigned NumBits, const GlobalValue *GV = nullptr) const {}
216-
217215
void printVecModifiedImmediate(const MachineOperand &MO, const char *Modifier,
218216
raw_ostream &O);
219217
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
220218
const char *Modifier = nullptr);
221-
void printImplicitDef(const MachineInstr *MI, raw_ostream &O) const;
222219
void printModuleLevelGV(const GlobalVariable *GVar, raw_ostream &O,
223220
bool = false);
224-
void printParamName(int paramIndex, raw_ostream &O);
225221
void printParamName(Function::const_arg_iterator I, int paramIndex,
226222
raw_ostream &O);
227223
void emitGlobals(const Module &M);
228224
void emitHeader(Module &M, raw_ostream &O, const NVPTXSubtarget &STI);
229225
void emitKernelFunctionDirectives(const Function &F, raw_ostream &O) const;
230226
void emitVirtualRegister(unsigned int vr, raw_ostream &);
231-
void emitFunctionExternParamList(const MachineFunction &MF);
232227
void emitFunctionParamList(const Function *, raw_ostream &O);
233228
void emitFunctionParamList(const MachineFunction &MF, raw_ostream &O);
234229
void setAndEmitFunctionVirtualRegisters(const MachineFunction &MF);
235-
void emitFunctionTempData(const MachineFunction &MF, unsigned &FrameSize);
236-
bool isImageType(Type *Ty);
237230
void printReturnValStr(const Function *, raw_ostream &O);
238231
void printReturnValStr(const MachineFunction &MF, raw_ostream &O);
239232
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
@@ -288,13 +281,9 @@ class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
288281
void bufferLEByte(const Constant *CPV, int Bytes, AggBuffer *aggBuffer);
289282
void bufferAggregateConstant(const Constant *CV, AggBuffer *aggBuffer);
290283

291-
void printOperandProper(const MachineOperand &MO);
292-
293284
void emitLinkageDirective(const GlobalValue *V, raw_ostream &O);
294285
void emitDeclarations(const Module &, raw_ostream &O);
295286
void emitDeclaration(const Function *, raw_ostream &O);
296-
297-
static const char *getRegisterName(unsigned RegNo);
298287
void emitDemotedVars(const Function *, raw_ostream &);
299288

300289
bool lowerImageHandleOperand(const MachineInstr *MI, unsigned OpNo,

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,15 +2012,6 @@ SDValue NVPTXTargetLowering::LowerSTOREi1(SDValue Op, SelectionDAG &DAG) const {
20122012
return Result;
20132013
}
20142014

2015-
SDValue NVPTXTargetLowering::getExtSymb(SelectionDAG &DAG, const char *inname,
2016-
int idx, EVT v) const {
2017-
std::string *name = nvTM->getManagedStrPool()->getManagedString(inname);
2018-
std::stringstream suffix;
2019-
suffix << idx;
2020-
*name += suffix.str();
2021-
return DAG.getTargetExternalSymbol(name->c_str(), v);
2022-
}
2023-
20242015
SDValue
20252016
NVPTXTargetLowering::getParamSymbol(SelectionDAG &DAG, int idx, EVT v) const {
20262017
std::string ParamSym;
@@ -2034,10 +2025,6 @@ NVPTXTargetLowering::getParamSymbol(SelectionDAG &DAG, int idx, EVT v) const {
20342025
return DAG.getTargetExternalSymbol(SavedStr->c_str(), v);
20352026
}
20362027

2037-
SDValue NVPTXTargetLowering::getParamHelpSymbol(SelectionDAG &DAG, int idx) {
2038-
return getExtSymb(DAG, ".HLPPARAM", idx);
2039-
}
2040-
20412028
// Check to see if the kernel argument is image*_t or sampler_t
20422029

20432030
bool llvm::isImageOrSamplerVal(const Value *arg, const Module *context) {
@@ -2550,20 +2537,6 @@ void NVPTXTargetLowering::LowerAsmOperandForConstraint(
25502537
TargetLowering::LowerAsmOperandForConstraint(Op, Constraint, Ops, DAG);
25512538
}
25522539

2553-
// NVPTX suuport vector of legal types of any length in Intrinsics because the
2554-
// NVPTX specific type legalizer
2555-
// will legalize them to the PTX supported length.
2556-
bool NVPTXTargetLowering::isTypeSupportedInIntrinsic(MVT VT) const {
2557-
if (isTypeLegal(VT))
2558-
return true;
2559-
if (VT.isVector()) {
2560-
MVT eVT = VT.getVectorElementType();
2561-
if (isTypeLegal(eVT))
2562-
return true;
2563-
}
2564-
return false;
2565-
}
2566-
25672540
static unsigned getOpcForTextureInstr(unsigned Intrinsic) {
25682541
switch (Intrinsic) {
25692542
default:
@@ -3823,11 +3796,6 @@ NVPTXTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
38233796
return TargetLowering::getRegForInlineAsmConstraint(TRI, Constraint, VT);
38243797
}
38253798

3826-
/// getFunctionAlignment - Return the Log2 alignment of this function.
3827-
unsigned NVPTXTargetLowering::getFunctionAlignment(const Function *) const {
3828-
return 4;
3829-
}
3830-
38313799
//===----------------------------------------------------------------------===//
38323800
// NVPTX DAG Combining
38333801
//===----------------------------------------------------------------------===//

llvm/lib/Target/NVPTX/NVPTXISelLowering.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,9 @@ class NVPTXTargetLowering : public TargetLowering {
441441
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
442442

443443
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
444-
SDValue LowerGlobalAddress(const GlobalValue *GV, int64_t Offset,
445-
SelectionDAG &DAG) const;
446444

447445
const char *getTargetNodeName(unsigned Opcode) const override;
448446

449-
bool isTypeSupportedInIntrinsic(MVT VT) const;
450-
451447
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I,
452448
unsigned Intrinsic) const override;
453449

@@ -467,9 +463,6 @@ class NVPTXTargetLowering : public TargetLowering {
467463
DstTy->getPrimitiveSizeInBits() == 32;
468464
}
469465

470-
/// getFunctionAlignment - Return the Log2 alignment of this function.
471-
unsigned getFunctionAlignment(const Function *F) const;
472-
473466
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Ctx,
474467
EVT VT) const override {
475468
if (VT.isVector())
@@ -523,11 +516,7 @@ class NVPTXTargetLowering : public TargetLowering {
523516

524517
private:
525518
const NVPTXSubtarget &STI; // cache the subtarget here
526-
527-
SDValue getExtSymb(SelectionDAG &DAG, const char *name, int idx,
528-
EVT = MVT::i32) const;
529519
SDValue getParamSymbol(SelectionDAG &DAG, int idx, EVT) const;
530-
SDValue getParamHelpSymbol(SelectionDAG &DAG, int idx);
531520

532521
SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const;
533522

llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,27 +87,6 @@ bool NVPTXInstrInfo::isMoveInstr(const MachineInstr &MI, unsigned &SrcReg,
8787
return false;
8888
}
8989

90-
bool NVPTXInstrInfo::isReadSpecialReg(MachineInstr &MI) const {
91-
switch (MI.getOpcode()) {
92-
default:
93-
return false;
94-
case NVPTX::INT_PTX_SREG_NTID_X:
95-
case NVPTX::INT_PTX_SREG_NTID_Y:
96-
case NVPTX::INT_PTX_SREG_NTID_Z:
97-
case NVPTX::INT_PTX_SREG_TID_X:
98-
case NVPTX::INT_PTX_SREG_TID_Y:
99-
case NVPTX::INT_PTX_SREG_TID_Z:
100-
case NVPTX::INT_PTX_SREG_CTAID_X:
101-
case NVPTX::INT_PTX_SREG_CTAID_Y:
102-
case NVPTX::INT_PTX_SREG_CTAID_Z:
103-
case NVPTX::INT_PTX_SREG_NCTAID_X:
104-
case NVPTX::INT_PTX_SREG_NCTAID_Y:
105-
case NVPTX::INT_PTX_SREG_NCTAID_Z:
106-
case NVPTX::INT_PTX_SREG_WARPSIZE:
107-
return true;
108-
}
109-
}
110-
11190
bool NVPTXInstrInfo::isLoadInstr(const MachineInstr &MI,
11291
unsigned &AddrSpace) const {
11392
bool isLoad = false;

llvm/lib/Target/NVPTX/NVPTXInstrInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class NVPTXInstrInfo : public NVPTXGenInstrInfo {
5656
unsigned &DestReg) const;
5757
bool isLoadInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
5858
bool isStoreInstr(const MachineInstr &MI, unsigned &AddrSpace) const;
59-
bool isReadSpecialReg(MachineInstr &MI) const;
6059

6160
virtual bool CanTailMerge(const MachineInstr *MI) const;
6261
// Branch analysis.

llvm/lib/Target/NVPTX/NVPTXUtilities.cpp

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -335,99 +335,6 @@ bool llvm::getAlign(const CallInst &I, unsigned index, unsigned &align) {
335335
return false;
336336
}
337337

338-
bool llvm::isBarrierIntrinsic(Intrinsic::ID id) {
339-
return (id == Intrinsic::nvvm_barrier0) ||
340-
(id == Intrinsic::nvvm_barrier0_popc) ||
341-
(id == Intrinsic::nvvm_barrier0_and) ||
342-
(id == Intrinsic::nvvm_barrier0_or) ||
343-
(id == Intrinsic::cuda_syncthreads);
344-
}
345-
346-
// Interface for checking all memory space transfer related intrinsics
347-
bool llvm::isMemorySpaceTransferIntrinsic(Intrinsic::ID id) {
348-
return id == Intrinsic::nvvm_ptr_local_to_gen ||
349-
id == Intrinsic::nvvm_ptr_shared_to_gen ||
350-
id == Intrinsic::nvvm_ptr_global_to_gen ||
351-
id == Intrinsic::nvvm_ptr_constant_to_gen ||
352-
id == Intrinsic::nvvm_ptr_gen_to_global ||
353-
id == Intrinsic::nvvm_ptr_gen_to_shared ||
354-
id == Intrinsic::nvvm_ptr_gen_to_local ||
355-
id == Intrinsic::nvvm_ptr_gen_to_constant ||
356-
id == Intrinsic::nvvm_ptr_gen_to_param;
357-
}
358-
359-
// consider several special intrinsics in striping pointer casts, and
360-
// provide an option to ignore GEP indices for find out the base address only
361-
// which could be used in simple alias disambiguation.
362-
const Value *
363-
llvm::skipPointerTransfer(const Value *V, bool ignore_GEP_indices) {
364-
V = V->stripPointerCasts();
365-
while (true) {
366-
if (const IntrinsicInst *IS = dyn_cast<IntrinsicInst>(V)) {
367-
if (isMemorySpaceTransferIntrinsic(IS->getIntrinsicID())) {
368-
V = IS->getArgOperand(0)->stripPointerCasts();
369-
continue;
370-
}
371-
} else if (ignore_GEP_indices)
372-
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
373-
V = GEP->getPointerOperand()->stripPointerCasts();
374-
continue;
375-
}
376-
break;
377-
}
378-
return V;
379-
}
380-
381-
// consider several special intrinsics in striping pointer casts, and
382-
// - ignore GEP indices for find out the base address only, and
383-
// - tracking PHINode
384-
// which could be used in simple alias disambiguation.
385-
const Value *
386-
llvm::skipPointerTransfer(const Value *V, std::set<const Value *> &processed) {
387-
if (processed.find(V) != processed.end())
388-
return nullptr;
389-
processed.insert(V);
390-
391-
const Value *V2 = V->stripPointerCasts();
392-
if (V2 != V && processed.find(V2) != processed.end())
393-
return nullptr;
394-
processed.insert(V2);
395-
396-
V = V2;
397-
398-
while (true) {
399-
if (const IntrinsicInst *IS = dyn_cast<IntrinsicInst>(V)) {
400-
if (isMemorySpaceTransferIntrinsic(IS->getIntrinsicID())) {
401-
V = IS->getArgOperand(0)->stripPointerCasts();
402-
continue;
403-
}
404-
} else if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
405-
V = GEP->getPointerOperand()->stripPointerCasts();
406-
continue;
407-
} else if (const PHINode *PN = dyn_cast<PHINode>(V)) {
408-
if (V != V2 && processed.find(V) != processed.end())
409-
return nullptr;
410-
processed.insert(PN);
411-
const Value *common = nullptr;
412-
for (unsigned i = 0; i != PN->getNumIncomingValues(); ++i) {
413-
const Value *pv = PN->getIncomingValue(i);
414-
const Value *base = skipPointerTransfer(pv, processed);
415-
if (base) {
416-
if (!common)
417-
common = base;
418-
else if (common != base)
419-
return PN;
420-
}
421-
}
422-
if (!common)
423-
return PN;
424-
V = common;
425-
}
426-
break;
427-
}
428-
return V;
429-
}
430-
431338
// The following are some useful utilities for debugging
432339

433340
BasicBlock *llvm::getParentBlock(Value *v) {

llvm/lib/Target/NVPTX/NVPTXUtilities.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,6 @@ bool isKernelFunction(const llvm::Function &);
6161
bool getAlign(const llvm::Function &, unsigned index, unsigned &);
6262
bool getAlign(const llvm::CallInst &, unsigned index, unsigned &);
6363

64-
bool isBarrierIntrinsic(llvm::Intrinsic::ID);
65-
66-
/// make_vector - Helper function which is useful for building temporary vectors
67-
/// to pass into type construction of CallInst ctors. This turns a null
68-
/// terminated list of pointers (or other value types) into a real live vector.
69-
///
70-
template <typename T> inline std::vector<T> make_vector(T A, ...) {
71-
va_list Args;
72-
va_start(Args, A);
73-
std::vector<T> Result;
74-
Result.push_back(A);
75-
while (T Val = va_arg(Args, T))
76-
Result.push_back(Val);
77-
va_end(Args);
78-
return Result;
79-
}
80-
81-
bool isMemorySpaceTransferIntrinsic(Intrinsic::ID id);
82-
const Value *skipPointerTransfer(const Value *V, bool ignore_GEP_indices);
83-
const Value *
84-
skipPointerTransfer(const Value *V, std::set<const Value *> &processed);
8564
BasicBlock *getParentBlock(Value *v);
8665
Function *getParentFunction(Value *v);
8766
void dumpBlock(Value *v, char *blockName);

0 commit comments

Comments
 (0)