31 class NVPTXAssignValidGlobalNames :
public ModulePass {
34 NVPTXAssignValidGlobalNames() :
ModulePass(ID) {}
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()));
66 if (
F.hasLocalLinkage())
67 F.setName(cleanUpName(
F.getName()));
72 std::string NVPTXAssignValidGlobalNames::cleanUpName(
StringRef Name) {
73 std::string ValidName;
75 for (
unsigned I = 0,
E = Name.
size();
I !=
E; ++
I) {
77 if (C ==
'.' || C ==
'@') {
78 ValidNameStream <<
"_$_";
84 return ValidNameStream.
str();
88 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. ...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
ModulePass * createNVPTXAssignValidGlobalNamesPass()
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &)
LLVM_NODISCARD size_t size() const
size - Get the string size.
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...