31class NVPTXAssignValidGlobalNames :
public ModulePass {
43char NVPTXAssignValidGlobalNames::ID = 0;
50 "Assign valid PTX names to globals",
false,
false)
52bool NVPTXAssignValidGlobalNames::runOnModule(
Module &M) {
55 if (GV.hasLocalLinkage()) {
60 GV.setName(cleanUpName(GV.getName()));
66 if (
F.hasLocalLinkage())
67 F.setName(cleanUpName(
F.getName()));
72std::string NVPTXAssignValidGlobalNames::cleanUpName(
StringRef Name) {
73 std::string ValidName;
76 if (
C ==
'.' ||
C ==
'@') {
77 ValidNameStream <<
"_$_";
83 return ValidNameStream.str();
87 return new NVPTXAssignValidGlobalNames();
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
StringRef - Represent a constant reference to a string, i.e.
A raw_ostream that writes to an std::string.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
ModulePass * createNVPTXAssignValidGlobalNamesPass()
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &)