mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 03:29:40 +00:00
make mdnMap type safe, rename accessors for consistency with the rest of llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92331 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
51ea55f0ec
commit
307c9893fc
@ -483,7 +483,7 @@ private:
|
|||||||
unsigned fNext;
|
unsigned fNext;
|
||||||
|
|
||||||
/// mdnMap - Map for MDNodes.
|
/// mdnMap - Map for MDNodes.
|
||||||
ValueMap mdnMap;
|
DenseMap<const MDNode*, unsigned> mdnMap;
|
||||||
unsigned mdnNext;
|
unsigned mdnNext;
|
||||||
public:
|
public:
|
||||||
/// Construct from a module
|
/// Construct from a module
|
||||||
@ -510,10 +510,11 @@ public:
|
|||||||
void purgeFunction();
|
void purgeFunction();
|
||||||
|
|
||||||
/// MDNode map iterators.
|
/// MDNode map iterators.
|
||||||
ValueMap::iterator mdnBegin() { return mdnMap.begin(); }
|
typedef DenseMap<const MDNode*, unsigned>::iterator mdn_iterator;
|
||||||
ValueMap::iterator mdnEnd() { return mdnMap.end(); }
|
mdn_iterator mdn_begin() { return mdnMap.begin(); }
|
||||||
unsigned mdnSize() const { return mdnMap.size(); }
|
mdn_iterator mdn_end() { return mdnMap.end(); }
|
||||||
bool mdnEmpty() const { return mdnMap.empty(); }
|
unsigned mdn_size() const { return mdnMap.size(); }
|
||||||
|
bool mdn_empty() const { return mdnMap.empty(); }
|
||||||
|
|
||||||
/// This function does the actual initialization.
|
/// This function does the actual initialization.
|
||||||
inline void initialize();
|
inline void initialize();
|
||||||
@ -694,13 +695,13 @@ int SlotTracker::getGlobalSlot(const GlobalValue *V) {
|
|||||||
return MI == mMap.end() ? -1 : (int)MI->second;
|
return MI == mMap.end() ? -1 : (int)MI->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getGlobalSlot - Get the slot number of a MDNode.
|
/// getMetadataSlot - Get the slot number of a MDNode.
|
||||||
int SlotTracker::getMetadataSlot(const MDNode *N) {
|
int SlotTracker::getMetadataSlot(const MDNode *N) {
|
||||||
// Check for uninitialized state and do lazy initialization.
|
// Check for uninitialized state and do lazy initialization.
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
// Find the type plane in the module map
|
// Find the type plane in the module map
|
||||||
ValueMap::iterator MI = mdnMap.find(N);
|
mdn_iterator MI = mdnMap.find(N);
|
||||||
return MI == mdnMap.end() ? -1 : (int)MI->second;
|
return MI == mdnMap.end() ? -1 : (int)MI->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +755,7 @@ void SlotTracker::CreateMetadataSlot(const MDNode *N) {
|
|||||||
if (N->isFunctionLocal())
|
if (N->isFunctionLocal())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ValueMap::iterator I = mdnMap.find(N);
|
mdn_iterator I = mdnMap.find(N);
|
||||||
if (I != mdnMap.end())
|
if (I != mdnMap.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1366,7 +1367,7 @@ void AssemblyWriter::printModule(const Module *M) {
|
|||||||
printNamedMDNode(I);
|
printNamedMDNode(I);
|
||||||
|
|
||||||
// Output metadata.
|
// Output metadata.
|
||||||
if (!Machine.mdnEmpty()) {
|
if (!Machine.mdn_empty()) {
|
||||||
Out << '\n';
|
Out << '\n';
|
||||||
writeAllMDNodes();
|
writeAllMDNodes();
|
||||||
}
|
}
|
||||||
@ -2003,9 +2004,9 @@ static void WriteMDNodeComment(const MDNode *Node,
|
|||||||
|
|
||||||
void AssemblyWriter::writeAllMDNodes() {
|
void AssemblyWriter::writeAllMDNodes() {
|
||||||
SmallVector<const MDNode *, 16> Nodes;
|
SmallVector<const MDNode *, 16> Nodes;
|
||||||
Nodes.resize(Machine.mdnSize());
|
Nodes.resize(Machine.mdn_size());
|
||||||
for (SlotTracker::ValueMap::iterator I =
|
for (SlotTracker::mdn_iterator I = Machine.mdn_begin(), E = Machine.mdn_end();
|
||||||
Machine.mdnBegin(), E = Machine.mdnEnd(); I != E; ++I)
|
I != E; ++I)
|
||||||
Nodes[I->second] = cast<MDNode>(I->first);
|
Nodes[I->second] = cast<MDNode>(I->first);
|
||||||
|
|
||||||
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user