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();
size_t size() const
size - Get the string size.
A Module instance is used to store all the information related to an LLVM module. ...
ModulePass * createNVPTXAssignValidGlobalNamesPass()
std::string str() const
str - Get the contents as an std::string.
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &)
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.
C - The default llvm calling convention, compatible with C.
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...