LLVM 24.0.0git
NVPTXAssignValidGlobalNames.cpp File Reference
#include "NVPTX.h"
#include "NVPTXUtilities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"

Go to the source code of this file.

Functions

static bool assignValidName (GlobalValue &GV)
 Give GV a name that is a valid PTX identifier, returning whether it had to be renamed.
static bool assignValidGlobalNames (Module &M)
 INITIALIZE_PASS (NVPTXAssignValidGlobalNamesLegacyPass, "nvptx-assign-valid-global-names", "Assign valid PTX names to globals", false, false) ModulePass *llvm

Function Documentation

◆ assignValidGlobalNames()

bool assignValidGlobalNames ( Module & M)
static

◆ assignValidName()

bool assignValidName ( GlobalValue & GV)
static

Give GV a name that is a valid PTX identifier, returning whether it had to be renamed.

Invalid names are rare, so checking first lets the pass report accurately that it left the module alone.

Note: this does not create collisions - if setName is asked to set the name to something that already exists, it adds a proper postfix to avoid collisions.

Definition at line 35 of file NVPTXAssignValidGlobalNames.cpp.

References llvm::Value::getName(), llvm::NVPTX::getValidPTXIdentifier(), and llvm::Value::setName().

Referenced by assignValidGlobalNames().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( NVPTXAssignValidGlobalNamesLegacyPass ,
"nvptx-assign-valid-global-names" ,
"Assign valid PTX names to globals" ,
false ,
false  )