Skip to content

Commit f419513

Browse files
authored
Remove unused utility functions; NFC (#2275)
1 parent a682bb3 commit f419513

File tree

2 files changed

+0
-53
lines changed

2 files changed

+0
-53
lines changed

lib/SPIRV/SPIRVInternal.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,6 @@ template <typename T> T getArgAs(CallInst *CI, unsigned I) {
585585
/// \param I argument index.
586586
Scope getArgAsScope(CallInst *CI, unsigned I);
587587

588-
/// Get constant function call argument as a Decoration enum.
589-
/// \param I argument index.
590-
Decoration getArgAsDecoration(CallInst *CI, unsigned I);
591-
592588
/// Check if a type is OCL image type.
593589
/// \return type name without "opencl." prefix.
594590
bool isOCLImageType(llvm::Type *Ty, StringRef *Name = nullptr);
@@ -603,12 +599,6 @@ bool isSYCLHalfType(llvm::Type *Ty);
603599

604600
bool isSYCLBfloat16Type(llvm::Type *Ty);
605601

606-
/// Decorate a function name as __spirv_{Name}_
607-
std::string decorateSPIRVFunction(const std::string &S);
608-
609-
/// Remove prefix/postfix from __spirv_{Name}_
610-
StringRef undecorateSPIRVFunction(StringRef S);
611-
612602
/// Check if a function has decorated name as __spirv_{Name}_
613603
/// and get the original name.
614604
bool isDecoratedSPIRVFunc(const Function *F, StringRef &UndecName);
@@ -789,13 +779,6 @@ std::set<std::string> getNamedMDAsStringSet(Module *M,
789779
/// Get SPIR-V language by SPIR-V metadata spirv.Source
790780
std::tuple<unsigned, unsigned, std::string> getSPIRVSource(Module *M);
791781

792-
/// Map an unsigned integer constant by applying a function.
793-
ConstantInt *mapUInt(Module *M, ConstantInt *I,
794-
std::function<unsigned(unsigned)> F);
795-
796-
/// Map a signed integer constant by applying a function.
797-
ConstantInt *mapSInt(Module *M, ConstantInt *I, std::function<int(int)> F);
798-
799782
/// Get postfix for given decoration.
800783
/// The returned postfix does not include "_" at the beginning.
801784
std::string getPostfix(Decoration Dec, unsigned Value = 0);
@@ -923,9 +906,6 @@ std::string getSPIRVFriendlyIRFunctionName(OCLExtOpKind ExtOpId,
923906
std::string getSPIRVFriendlyIRFunctionName(const std::string &UniqName,
924907
spv::Op OC, ArrayRef<Type *> ArgTys);
925908

926-
/// Cast a function to a void(void) funtion pointer.
927-
Constant *castToVoidFuncPtr(Function *F);
928-
929909
/// Get i8* with the same address space.
930910
PointerType *getInt8PtrTy(PointerType *T);
931911

lib/SPIRV/SPIRVUtil.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -309,21 +309,6 @@ Scope getArgAsScope(CallInst *CI, unsigned I) {
309309
return static_cast<Scope>(getArgAsInt(CI, I));
310310
}
311311

312-
Decoration getArgAsDecoration(CallInst *CI, unsigned I) {
313-
return static_cast<Decoration>(getArgAsInt(CI, I));
314-
}
315-
316-
std::string decorateSPIRVFunction(const std::string &S) {
317-
return std::string(kSPIRVName::Prefix) + S + kSPIRVName::Postfix;
318-
}
319-
320-
StringRef undecorateSPIRVFunction(StringRef S) {
321-
assert(S.find(kSPIRVName::Prefix) == 0);
322-
const size_t Start = strlen(kSPIRVName::Prefix);
323-
auto End = S.rfind(kSPIRVName::Postfix);
324-
return S.substr(Start, End - Start);
325-
}
326-
327312
std::string prefixSPIRVName(const std::string &S) {
328313
return std::string(kSPIRVName::Prefix) + S;
329314
}
@@ -558,11 +543,6 @@ bool containsUnsignedAtomicType(StringRef Name) {
558543
Name[Loc + strlen(kMangledName::AtomicPrefixIncoming)]);
559544
}
560545

561-
Constant *castToVoidFuncPtr(Function *F) {
562-
auto *T = getVoidFuncPtrType(F->getParent());
563-
return ConstantExpr::getBitCast(F, T);
564-
}
565-
566546
bool hasArrayArg(Function *F) {
567547
for (auto I = F->arg_begin(), E = F->arg_end(); I != E; ++I) {
568548
LLVM_DEBUG(dbgs() << "[hasArrayArg] " << *I << '\n');
@@ -1028,10 +1008,6 @@ void makeVector(Instruction *InsPos, std::vector<Value *> &Ops,
10281008
Ops.push_back(Vec);
10291009
}
10301010

1031-
Constant *castToInt8Ptr(Constant *V, unsigned Addr = 0) {
1032-
return ConstantExpr::getBitCast(V, PointerType::get(V->getContext(), Addr));
1033-
}
1034-
10351011
PointerType *getInt8PtrTy(PointerType *T) {
10361012
return PointerType::get(T->getContext(), T->getAddressSpace());
10371013
}
@@ -1159,15 +1135,6 @@ std::tuple<unsigned, unsigned, std::string> getSPIRVSource(Module *M) {
11591135
return Tup;
11601136
}
11611137

1162-
ConstantInt *mapUInt(Module *M, ConstantInt *I,
1163-
std::function<unsigned(unsigned)> F) {
1164-
return ConstantInt::get(I->getIntegerType(), F(I->getZExtValue()), false);
1165-
}
1166-
1167-
ConstantInt *mapSInt(Module *M, ConstantInt *I, std::function<int(int)> F) {
1168-
return ConstantInt::get(I->getIntegerType(), F(I->getSExtValue()), true);
1169-
}
1170-
11711138
bool isDecoratedSPIRVFunc(const Function *F, StringRef &UndecoratedName) {
11721139
if (!F->hasName() || !F->getName().starts_with(kSPIRVName::Prefix))
11731140
return false;

0 commit comments

Comments
 (0)