32 class NVPTXAssignValidGlobalNames :
public ModulePass {
35 NVPTXAssignValidGlobalNames() :
ModulePass(ID) {}
37 bool runOnModule(
Module &M)
override;
51 "Assign valid PTX names to globals",
false,
false)
53 bool NVPTXAssignValidGlobalNames::runOnModule(
Module &M) {
56 if (GV.hasLocalLinkage()) {
61 GV.setName(cleanUpName(GV.getName()));
67 if (
F.hasLocalLinkage())
68 F.setName(cleanUpName(
F.getName()));
73 std::string NVPTXAssignValidGlobalNames::cleanUpName(
StringRef Name) {
74 std::string ValidName;
76 for (
unsigned I = 0,
E = Name.
size();
I !=
E; ++
I) {
78 if (C ==
'.' || C ==
'@') {
79 ValidNameStream <<
"_$_";
85 return ValidNameStream.
str();
89 return new NVPTXAssignValidGlobalNames();
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
ModulePass * createNVPTXAssignValidGlobalNamesPass()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
Module.h This file contains the declarations for the Module class.
INITIALIZE_PASS(NVPTXAssignValidGlobalNames, "nvptx-assign-valid-global-names", "Assign valid PTX names to globals", false, false) bool NVPTXAssignValidGlobalNames
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A raw_ostream that writes to an std::string.
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...