mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Optimize MDNode to coallocate the operand list immediately
after the MDNode in memory. This eliminates the operands pointer and saves a new[] per node. Note that the code in DIDerivedType::replaceAllUsesWith is wrong and quite scary. A MDNode should not be RAUW'd with something else: this changes all uses of the mdnode, which may not be debug info related! Debug info should use something non-mdnode for declarations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92321 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
+11
-5
@@ -90,7 +90,8 @@ class MDNode : public MetadataBase, public FoldingSetNode {
|
||||
void operator=(const MDNode &); // DO NOT IMPLEMENT
|
||||
friend class MDNodeElement;
|
||||
|
||||
MDNodeElement *Operands;
|
||||
/// NumOperands - This many 'MDNodeElement' items are co-allocated onto the
|
||||
/// end of this MDNode.
|
||||
unsigned NumOperands;
|
||||
|
||||
// Subclass data enums.
|
||||
@@ -102,11 +103,16 @@ class MDNode : public MetadataBase, public FoldingSetNode {
|
||||
|
||||
/// NotUniquedBit - This is set on MDNodes that are not uniqued because they
|
||||
/// have a null perand.
|
||||
NotUniquedBit = 1 << 1
|
||||
NotUniquedBit = 1 << 1,
|
||||
|
||||
/// DestroyFlag - This bit is set by destroy() so the destructor can assert
|
||||
/// that the node isn't being destroyed with a plain 'delete'.
|
||||
DestroyFlag = 1 << 2
|
||||
};
|
||||
|
||||
// Replace each instance of F from the element list of this node with T.
|
||||
void replaceElement(MDNodeElement *Op, Value *NewVal);
|
||||
~MDNode();
|
||||
|
||||
protected:
|
||||
explicit MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
|
||||
@@ -115,9 +121,6 @@ public:
|
||||
// Constructors and destructors.
|
||||
static MDNode *get(LLVMContext &Context, Value *const *Vals, unsigned NumVals,
|
||||
bool isFunctionLocal = false);
|
||||
|
||||
/// ~MDNode - Destroy MDNode.
|
||||
~MDNode();
|
||||
|
||||
/// getElement - Return specified element.
|
||||
Value *getElement(unsigned i) const;
|
||||
@@ -133,6 +136,9 @@ public:
|
||||
return (getSubclassDataFromValue() & FunctionLocalBit) != 0;
|
||||
}
|
||||
|
||||
// destroy - Delete this node. Only when there are no uses.
|
||||
void destroy();
|
||||
|
||||
/// Profile - calculate a unique identifier for this MDNode to collapse
|
||||
/// duplicates
|
||||
void Profile(FoldingSetNodeID &ID) const;
|
||||
|
||||
Reference in New Issue
Block a user