Skip to content

Commit 9d1dfd9

Browse files
svenvhsys-ce-bb
authored andcommitted
Remove unused utility functions; NFC (#2275)
Original commit: KhronosGroup/SPIRV-LLVM-Translator@f419513
1 parent e6d123f commit 9d1dfd9

File tree

2 files changed

+0
-53
lines changed

2 files changed

+0
-53
lines changed

llvm-spirv/lib/SPIRV/SPIRVInternal.h

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

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

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

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

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

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

llvm-spirv/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
}
@@ -560,11 +545,6 @@ bool containsUnsignedAtomicType(StringRef Name) {
560545
Name[Loc + strlen(kMangledName::AtomicPrefixIncoming)]);
561546
}
562547

563-
Constant *castToVoidFuncPtr(Function *F) {
564-
auto *T = getVoidFuncPtrType(F->getParent());
565-
return ConstantExpr::getBitCast(F, T);
566-
}
567-
568548
bool hasArrayArg(Function *F) {
569549
for (auto I = F->arg_begin(), E = F->arg_end(); I != E; ++I) {
570550
LLVM_DEBUG(dbgs() << "[hasArrayArg] " << *I << '\n');
@@ -1030,10 +1010,6 @@ void makeVector(Instruction *InsPos, std::vector<Value *> &Ops,
10301010
Ops.push_back(Vec);
10311011
}
10321012

1033-
Constant *castToInt8Ptr(Constant *V, unsigned Addr = 0) {
1034-
return ConstantExpr::getBitCast(V, PointerType::get(V->getContext(), Addr));
1035-
}
1036-
10371013
PointerType *getInt8PtrTy(PointerType *T) {
10381014
return PointerType::get(T->getContext(), T->getAddressSpace());
10391015
}
@@ -1161,15 +1137,6 @@ std::tuple<unsigned, unsigned, std::string> getSPIRVSource(Module *M) {
11611137
return Tup;
11621138
}
11631139

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

0 commit comments

Comments
 (0)