32class NVPTXAssignValidGlobalNames :
public ModulePass {
44char NVPTXAssignValidGlobalNames::ID = 0;
51 "Assign valid PTX names to globals",
false,
false)
53bool NVPTXAssignValidGlobalNames::runOnModule(
Module &M) {
56 if (GV.hasLocalLinkage()) {
61 GV.setName(cleanUpName(GV.getName()));
67 if (
F.hasLocalLinkage())
68 F.setName(cleanUpName(
F.getName()));
73std::string NVPTXAssignValidGlobalNames::cleanUpName(
StringRef Name) {
74 std::string ValidName;
79 if (isAlnum(
C) ||
C ==
'_' ||
C ==
'$') {
82 ValidNameStream <<
"_$_";
86 return ValidNameStream.str();
90 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.
@ C
The default llvm calling convention, compatible with C.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
ModulePass * createNVPTXAssignValidGlobalNamesPass()
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &)