mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
simplify asmprinting of NamedMDNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92324 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -475,9 +475,6 @@ private:
|
|||||||
/// TheMDNode - The MDNode for which we are holding slot numbers.
|
/// TheMDNode - The MDNode for which we are holding slot numbers.
|
||||||
const MDNode *TheMDNode;
|
const MDNode *TheMDNode;
|
||||||
|
|
||||||
/// TheNamedMDNode - The MDNode for which we are holding slot numbers.
|
|
||||||
const NamedMDNode *TheNamedMDNode;
|
|
||||||
|
|
||||||
/// mMap - The TypePlanes map for the module level data.
|
/// mMap - The TypePlanes map for the module level data.
|
||||||
ValueMap mMap;
|
ValueMap mMap;
|
||||||
unsigned mNext;
|
unsigned mNext;
|
||||||
@@ -496,8 +493,6 @@ public:
|
|||||||
explicit SlotTracker(const Function *F);
|
explicit SlotTracker(const Function *F);
|
||||||
/// Construct from a mdnode.
|
/// Construct from a mdnode.
|
||||||
explicit SlotTracker(const MDNode *N);
|
explicit SlotTracker(const MDNode *N);
|
||||||
/// Construct from a named mdnode.
|
|
||||||
explicit SlotTracker(const NamedMDNode *N);
|
|
||||||
|
|
||||||
/// Return the slot number of the specified value in it's type
|
/// Return the slot number of the specified value in it's type
|
||||||
/// plane. If something is not in the SlotTracker, return -1.
|
/// plane. If something is not in the SlotTracker, return -1.
|
||||||
@@ -547,9 +542,6 @@ private:
|
|||||||
/// Add all MDNode operands.
|
/// Add all MDNode operands.
|
||||||
void processMDNode();
|
void processMDNode();
|
||||||
|
|
||||||
/// Add all MDNode operands.
|
|
||||||
void processNamedMDNode();
|
|
||||||
|
|
||||||
SlotTracker(const SlotTracker &); // DO NOT IMPLEMENT
|
SlotTracker(const SlotTracker &); // DO NOT IMPLEMENT
|
||||||
void operator=(const SlotTracker &); // DO NOT IMPLEMENT
|
void operator=(const SlotTracker &); // DO NOT IMPLEMENT
|
||||||
};
|
};
|
||||||
@@ -589,26 +581,20 @@ static SlotTracker *createSlotTracker(const Value *V) {
|
|||||||
// to be added to the slot table.
|
// to be added to the slot table.
|
||||||
SlotTracker::SlotTracker(const Module *M)
|
SlotTracker::SlotTracker(const Module *M)
|
||||||
: TheModule(M), TheFunction(0), FunctionProcessed(false), TheMDNode(0),
|
: TheModule(M), TheFunction(0), FunctionProcessed(false), TheMDNode(0),
|
||||||
TheNamedMDNode(0), mNext(0), fNext(0), mdnNext(0) {
|
mNext(0), fNext(0), mdnNext(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function level constructor. Causes the contents of the Module and the one
|
// Function level constructor. Causes the contents of the Module and the one
|
||||||
// function provided to be added to the slot table.
|
// function provided to be added to the slot table.
|
||||||
SlotTracker::SlotTracker(const Function *F)
|
SlotTracker::SlotTracker(const Function *F)
|
||||||
: TheModule(F ? F->getParent() : 0), TheFunction(F), FunctionProcessed(false),
|
: TheModule(F ? F->getParent() : 0), TheFunction(F), FunctionProcessed(false),
|
||||||
TheMDNode(0), TheNamedMDNode(0), mNext(0), fNext(0), mdnNext(0) {
|
TheMDNode(0), mNext(0), fNext(0), mdnNext(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor to handle single MDNode.
|
// Constructor to handle single MDNode.
|
||||||
SlotTracker::SlotTracker(const MDNode *C)
|
SlotTracker::SlotTracker(const MDNode *C)
|
||||||
: TheModule(0), TheFunction(0), FunctionProcessed(false), TheMDNode(C),
|
: TheModule(0), TheFunction(0), FunctionProcessed(false), TheMDNode(C),
|
||||||
TheNamedMDNode(0), mNext(0), fNext(0), mdnNext(0) {
|
mNext(0), fNext(0), mdnNext(0) {
|
||||||
}
|
|
||||||
|
|
||||||
// Constructor to handle single NamedMDNode.
|
|
||||||
SlotTracker::SlotTracker(const NamedMDNode *N)
|
|
||||||
: TheModule(0), TheFunction(0), FunctionProcessed(false), TheMDNode(0),
|
|
||||||
TheNamedMDNode(N), mNext(0), fNext(0), mdnNext(0) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SlotTracker::initialize() {
|
inline void SlotTracker::initialize() {
|
||||||
@@ -622,9 +608,6 @@ inline void SlotTracker::initialize() {
|
|||||||
|
|
||||||
if (TheMDNode)
|
if (TheMDNode)
|
||||||
processMDNode();
|
processMDNode();
|
||||||
|
|
||||||
if (TheNamedMDNode)
|
|
||||||
processNamedMDNode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate through all the global variables, functions, and global
|
// Iterate through all the global variables, functions, and global
|
||||||
@@ -718,19 +701,6 @@ void SlotTracker::processMDNode() {
|
|||||||
ST_DEBUG("end processMDNode!\n");
|
ST_DEBUG("end processMDNode!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// processNamedMDNode - Process TheNamedMDNode.
|
|
||||||
void SlotTracker::processNamedMDNode() {
|
|
||||||
ST_DEBUG("begin processNamedMDNode!\n");
|
|
||||||
mdnNext = 0;
|
|
||||||
for (unsigned i = 0, e = TheNamedMDNode->getNumOperands(); i != e; ++i) {
|
|
||||||
MDNode *MD = dyn_cast_or_null<MDNode>(TheNamedMDNode->getOperand(i));
|
|
||||||
if (MD)
|
|
||||||
CreateMetadataSlot(MD);
|
|
||||||
}
|
|
||||||
TheNamedMDNode = 0;
|
|
||||||
ST_DEBUG("end processNamedMDNode!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Clean up after incorporating a function. This is the only way to get out of
|
/// Clean up after incorporating a function. This is the only way to get out of
|
||||||
/// the function incorporation state that affects get*Slot/Create*Slot. Function
|
/// the function incorporation state that affects get*Slot/Create*Slot. Function
|
||||||
/// incorporation state is indicated by TheFunction != 0.
|
/// incorporation state is indicated by TheFunction != 0.
|
||||||
@@ -2134,7 +2104,7 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
|
|||||||
SlotTable.initialize();
|
SlotTable.initialize();
|
||||||
WriteMDNodes(OS, TypePrinter, SlotTable);
|
WriteMDNodes(OS, TypePrinter, SlotTable);
|
||||||
} else if (const NamedMDNode *N = dyn_cast<NamedMDNode>(this)) {
|
} else if (const NamedMDNode *N = dyn_cast<NamedMDNode>(this)) {
|
||||||
SlotTracker SlotTable(N);
|
SlotTracker SlotTable(N->getParent());
|
||||||
TypePrinting TypePrinter;
|
TypePrinting TypePrinter;
|
||||||
SlotTable.initialize();
|
SlotTable.initialize();
|
||||||
OS << "!" << N->getName() << " = !{";
|
OS << "!" << N->getName() << " = !{";
|
||||||
|
Reference in New Issue
Block a user