31 class NVPTXAssignValidGlobalNames :
public ModulePass {
36 bool runOnModule(
Module &M)
override;
50 "Assign valid PTX names to globals",
false,
false)
52 bool NVPTXAssignValidGlobalNames::runOnModule(
Module &M) {
55 if (GV.hasLocalLinkage()) {
60 GV.setName(cleanUpName(GV.getName()));
67 std::string NVPTXAssignValidGlobalNames::cleanUpName(
StringRef Name) {
68 std::string ValidName;
70 for (
unsigned I = 0,
E = Name.
size();
I !=
E; ++
I) {
72 if (C ==
'.' || C ==
'@') {
73 ValidNameStream <<
"_$_";
79 return ValidNameStream.str();
83 return new NVPTXAssignValidGlobalNames();
A Module instance is used to store all the information related to an LLVM module. ...
ModulePass * createNVPTXAssignValidGlobalNamesPass()
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
Module.h This file contains the declarations for the Module class.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
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...