mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
IR: Cleanup comments for Value, User, and MDNode
A follow-up commit will modify the memory-layout of `Value`, `User`, and
`MDNode`. First fix the comments to be doxygen-friendly (and to follow
the coding standards).
- Use "\brief" instead of "repeatedName -".
- Add a brief intro where it was missing.
- Remove duplicated comments from source files (and a couple of
noisy/trivial comments altogether).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -35,7 +35,8 @@ enum LLVMConstants : uint32_t {
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// MDString - a single uniqued string.
|
||||
/// \brief A single uniqued string.
|
||||
///
|
||||
/// These are used to efficiently contain a byte sequence for metadata.
|
||||
/// MDString is always unnamed.
|
||||
class MDString : public Value {
|
||||
@@ -55,19 +56,19 @@ public:
|
||||
|
||||
typedef StringRef::iterator iterator;
|
||||
|
||||
/// begin() - Pointer to the first byte of the string.
|
||||
/// \brief Pointer to the first byte of the string.
|
||||
iterator begin() const { return getName().begin(); }
|
||||
|
||||
/// end() - Pointer to one byte past the end of the string.
|
||||
/// \brief Pointer to one byte past the end of the string.
|
||||
iterator end() const { return getName().end(); }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
/// \brief Methods for support type inquiry through isa, cast, and dyn_cast.
|
||||
static bool classof(const Value *V) {
|
||||
return V->getValueID() == MDStringVal;
|
||||
}
|
||||
};
|
||||
|
||||
/// AAMDNodes - A collection of metadata nodes that might be associated with a
|
||||
/// \brief A collection of metadata nodes that might be associated with a
|
||||
/// memory access used by the alias-analysis infrastructure.
|
||||
struct AAMDNodes {
|
||||
explicit AAMDNodes(MDNode *T = nullptr, MDNode *S = nullptr,
|
||||
@@ -82,13 +83,13 @@ struct AAMDNodes {
|
||||
|
||||
LLVM_EXPLICIT operator bool() const { return TBAA || Scope || NoAlias; }
|
||||
|
||||
/// TBAA - The tag for type-based alias analysis.
|
||||
/// \brief The tag for type-based alias analysis.
|
||||
MDNode *TBAA;
|
||||
|
||||
/// Scope - The tag for alias scope specification (used with noalias).
|
||||
/// \brief The tag for alias scope specification (used with noalias).
|
||||
MDNode *Scope;
|
||||
|
||||
/// NoAlias - The tag specifying the noalias scope.
|
||||
/// \brief The tag specifying the noalias scope.
|
||||
MDNode *NoAlias;
|
||||
};
|
||||
|
||||
@@ -114,7 +115,7 @@ struct DenseMapInfo<AAMDNodes> {
|
||||
class MDNodeOperand;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// MDNode - a tuple of other values.
|
||||
/// \brief A tuple of other values.
|
||||
class MDNode : public Value, public FoldingSetNode {
|
||||
MDNode(const MDNode &) LLVM_DELETED_FUNCTION;
|
||||
void operator=(const MDNode &) LLVM_DELETED_FUNCTION;
|
||||
@@ -122,14 +123,13 @@ class MDNode : public Value, public FoldingSetNode {
|
||||
friend class LLVMContextImpl;
|
||||
friend struct FoldingSetTrait<MDNode>;
|
||||
|
||||
/// Hash - If the MDNode is uniqued cache the hash to speed up lookup.
|
||||
/// \brief If the MDNode is uniqued cache the hash to speed up lookup.
|
||||
unsigned Hash;
|
||||
|
||||
/// NumOperands - This many 'MDNodeOperand' items are co-allocated onto the
|
||||
/// end of this MDNode.
|
||||
/// \brief Number of co-allocated 'MDNodeOperand' items.
|
||||
unsigned NumOperands;
|
||||
|
||||
// Subclass data enums.
|
||||
/// \brief Subclass data enums.
|
||||
enum {
|
||||
/// FunctionLocalBit - This bit is set if this MDNode is function local.
|
||||
/// This is true when it (potentially transitively) contains a reference to
|
||||
@@ -145,15 +145,14 @@ class MDNode : public Value, public FoldingSetNode {
|
||||
DestroyFlag = 1 << 2
|
||||
};
|
||||
|
||||
// FunctionLocal enums.
|
||||
/// \brief FunctionLocal enums.
|
||||
enum FunctionLocalness {
|
||||
FL_Unknown = -1,
|
||||
FL_No = 0,
|
||||
FL_Yes = 1
|
||||
};
|
||||
|
||||
/// replaceOperand - Replace each instance of F from the operand list of this
|
||||
/// node with T.
|
||||
/// \brief Replace each instance of the given operand with a new value.
|
||||
void replaceOperand(MDNodeOperand *Op, Value *NewVal);
|
||||
~MDNode();
|
||||
|
||||
@@ -162,58 +161,62 @@ class MDNode : public Value, public FoldingSetNode {
|
||||
static MDNode *getMDNode(LLVMContext &C, ArrayRef<Value*> Vals,
|
||||
FunctionLocalness FL, bool Insert = true);
|
||||
public:
|
||||
// Constructors and destructors.
|
||||
static MDNode *get(LLVMContext &Context, ArrayRef<Value*> Vals);
|
||||
// getWhenValsUnresolved - Construct MDNode determining function-localness
|
||||
// from isFunctionLocal argument, not by analyzing Vals.
|
||||
/// \brief Construct MDNode with an explicit function-localness.
|
||||
///
|
||||
/// Don't analyze Vals; trust isFunctionLocal.
|
||||
static MDNode *getWhenValsUnresolved(LLVMContext &Context,
|
||||
ArrayRef<Value*> Vals,
|
||||
bool isFunctionLocal);
|
||||
|
||||
static MDNode *getIfExists(LLVMContext &Context, ArrayRef<Value*> Vals);
|
||||
|
||||
/// getTemporary - Return a temporary MDNode, for use in constructing
|
||||
/// cyclic MDNode structures. A temporary MDNode is not uniqued,
|
||||
/// may be RAUW'd, and must be manually deleted with deleteTemporary.
|
||||
/// \brief Return a temporary MDNode
|
||||
///
|
||||
/// For use in constructing cyclic MDNode structures. A temporary MDNode is
|
||||
/// not uniqued, may be RAUW'd, and must be manually deleted with
|
||||
/// deleteTemporary.
|
||||
static MDNode *getTemporary(LLVMContext &Context, ArrayRef<Value*> Vals);
|
||||
|
||||
/// deleteTemporary - Deallocate a node created by getTemporary. The
|
||||
/// node must not have any users.
|
||||
/// \brief Deallocate a node created by getTemporary.
|
||||
///
|
||||
/// The node must not have any users.
|
||||
static void deleteTemporary(MDNode *N);
|
||||
|
||||
/// replaceOperandWith - Replace a specific operand.
|
||||
/// \brief Replace a specific operand.
|
||||
void replaceOperandWith(unsigned i, Value *NewVal);
|
||||
|
||||
/// getOperand - Return specified operand.
|
||||
/// \brief Return specified operand.
|
||||
Value *getOperand(unsigned i) const LLVM_READONLY;
|
||||
|
||||
/// getNumOperands - Return number of MDNode operands.
|
||||
/// \brief Return number of MDNode operands.
|
||||
unsigned getNumOperands() const { return NumOperands; }
|
||||
|
||||
/// isFunctionLocal - Return whether MDNode is local to a function.
|
||||
/// \brief Return whether MDNode is local to a function.
|
||||
bool isFunctionLocal() const {
|
||||
return (getSubclassDataFromValue() & FunctionLocalBit) != 0;
|
||||
}
|
||||
|
||||
// getFunction - If this metadata is function-local and recursively has a
|
||||
// function-local operand, return the first such operand's parent function.
|
||||
// Otherwise, return null. getFunction() should not be used for performance-
|
||||
// critical code because it recursively visits all the MDNode's operands.
|
||||
/// \brief Return the first function-local operand's function.
|
||||
///
|
||||
/// If this metadata is function-local and recursively has a function-local
|
||||
/// operand, return the first such operand's parent function. Otherwise,
|
||||
/// return null. getFunction() should not be used for performance- critical
|
||||
/// code because it recursively visits all the MDNode's operands.
|
||||
const Function *getFunction() const;
|
||||
|
||||
/// Profile - calculate a unique identifier for this MDNode to collapse
|
||||
/// duplicates
|
||||
/// \brief Calculate a unique identifier for this MDNode.
|
||||
void Profile(FoldingSetNodeID &ID) const;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
/// \brief Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static bool classof(const Value *V) {
|
||||
return V->getValueID() == MDNodeVal;
|
||||
}
|
||||
|
||||
/// Check whether MDNode is a vtable access.
|
||||
/// \brief Check whether MDNode is a vtable access.
|
||||
bool isTBAAVtableAccess() const;
|
||||
|
||||
/// Methods for metadata merging.
|
||||
/// \brief Methods for metadata merging.
|
||||
static MDNode *concatenate(MDNode *A, MDNode *B);
|
||||
static MDNode *intersect(MDNode *A, MDNode *B);
|
||||
static MDNode *getMostGenericTBAA(MDNode *A, MDNode *B);
|
||||
@@ -221,7 +224,7 @@ public:
|
||||
static MDNode *getMostGenericFPMath(MDNode *A, MDNode *B);
|
||||
static MDNode *getMostGenericRange(MDNode *A, MDNode *B);
|
||||
private:
|
||||
// destroy - Delete this node. Only when there are no uses.
|
||||
/// \brief Delete this node. Only when there are no uses.
|
||||
void destroy();
|
||||
|
||||
bool isNotUniqued() const {
|
||||
@@ -237,9 +240,10 @@ private:
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// NamedMDNode - a tuple of MDNodes. Despite its name, a NamedMDNode isn't
|
||||
/// itself an MDNode. NamedMDNodes belong to modules, have names, and contain
|
||||
/// lists of MDNodes.
|
||||
/// \brief A tuple of MDNodes.
|
||||
///
|
||||
/// Despite its name, a NamedMDNode isn't itself an MDNode. NamedMDNodes belong
|
||||
/// to modules, have names, and contain lists of MDNodes.
|
||||
class NamedMDNode : public ilist_node<NamedMDNode> {
|
||||
friend class SymbolTableListTraits<NamedMDNode, Module>;
|
||||
friend struct ilist_traits<NamedMDNode>;
|
||||
@@ -292,36 +296,23 @@ class NamedMDNode : public ilist_node<NamedMDNode> {
|
||||
};
|
||||
|
||||
public:
|
||||
/// eraseFromParent - Drop all references and remove the node from parent
|
||||
/// module.
|
||||
/// \brief Drop all references and remove the node from parent module.
|
||||
void eraseFromParent();
|
||||
|
||||
/// dropAllReferences - Remove all uses and clear node vector.
|
||||
/// \brief Remove all uses and clear node vector.
|
||||
void dropAllReferences();
|
||||
|
||||
/// ~NamedMDNode - Destroy NamedMDNode.
|
||||
~NamedMDNode();
|
||||
|
||||
/// getParent - Get the module that holds this named metadata collection.
|
||||
/// \brief Get the module that holds this named metadata collection.
|
||||
inline Module *getParent() { return Parent; }
|
||||
inline const Module *getParent() const { return Parent; }
|
||||
|
||||
/// getOperand - Return specified operand.
|
||||
MDNode *getOperand(unsigned i) const;
|
||||
|
||||
/// getNumOperands - Return the number of NamedMDNode operands.
|
||||
unsigned getNumOperands() const;
|
||||
|
||||
/// addOperand - Add metadata operand.
|
||||
void addOperand(MDNode *M);
|
||||
|
||||
/// getName - Return a constant reference to this named metadata's name.
|
||||
StringRef getName() const;
|
||||
|
||||
/// print - Implement operator<< on NamedMDNode.
|
||||
void print(raw_ostream &ROS) const;
|
||||
|
||||
/// dump() - Allow printing of NamedMDNodes from the debugger.
|
||||
void dump() const;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user