15#include "llvm/Config/llvm-config.h"
30#define DEBUG_TYPE "valuesymtab"
35 for (
const auto &
VI : vmap)
36 dbgs() <<
"Value still in symbol table! Type = '"
37 << *
VI.getValue()->getType() <<
"' Name = '" <<
VI.getKeyData()
39 assert(vmap.empty() &&
"Values remain in symbol table!");
45 unsigned BaseSize = UniqueName.
size();
48 UniqueName.
resize(BaseSize);
50 if (
auto *GV = dyn_cast<GlobalValue>(V)) {
57 const Module *M = GV->getParent();
64 auto IterBool = vmap.
insert(std::make_pair(UniqueName.
str(), V));
66 return &*IterBool.first;
72void ValueSymbolTable::reinsertValue(
Value *V) {
73 assert(
V->hasName() &&
"Can't insert nameless Value into symbol table");
76 if (vmap.
insert(
V->getValueName())) {
87 V->getValueName()->Destroy(Allocator);
89 ValueName *VN = makeUniqueName(V, UniqueName);
93void ValueSymbolTable::removeValueName(
ValueName *V) {
103 if (MaxNameSize > -1 &&
Name.size() > (
unsigned)MaxNameSize)
104 Name =
Name.substr(0, std::max(1u, (
unsigned)MaxNameSize));
107 auto IterBool = vmap.
insert(std::make_pair(
Name, V));
108 if (IterBool.second) {
111 return &*IterBool.first;
116 return makeUniqueName(V, UniqueName);
119#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
124 for (
const auto &
I : *
this) {
126 I.getValue()->dump();
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Module.h This file contains the declarations for the Module class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
A Module instance is used to store all the information related to an LLVM module.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef str() const
Explicit conversion to StringRef.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
void remove(MapEntryTy *KeyValue)
remove - Remove the specified key/value pair from the map, but do not erase it.
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
void dump() const
This function can be used from the debugger to display the content of the symbol table while debuggin...
LLVM Value Representation.
A raw_ostream that writes to an SmallVector or SmallString.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.