aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Function.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-12 17:45:29 +0000
committerChris Lattner <sabre@nondot.org>2008-03-12 17:45:29 +0000
commit58d74910c6b82e622ecbb57d6644d48fec5a5c0f (patch)
treef04d1ab294b3379bf97d9f727d4ade9e7079ca48 /include/llvm/Function.h
parent37f603f5d78f735e8de92113429b67c77aa58086 (diff)
Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around the underlying uniqued parameter attribute list object, and manages its refcount. It is now impossible to mess up the refcount. 2. PAListPtr is now the main interface to the underlying object, and the underlying object is now completely opaque. 3. Implementation details like SmallVector and FoldingSet are now no longer part of the interface. 4. You can create a PAListPtr with an arbitrary sequence of ParamAttrsWithIndex's, no need to make a SmallVector of a specific size (you can just use an array or scalar or vector if you wish). 5. All the client code that had to check for a null pointer before dereferencing the pointer is simplified to just access the PAListPtr directly. 6. The interfaces for adding attrs to a list and removing them is a bit simpler. Phase #2 will rename some stuff (e.g. PAListPtr) and do other less invasive changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Function.h')
-rw-r--r--include/llvm/Function.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 3d75db8a03..2ffd5eaacd 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -27,7 +27,6 @@
namespace llvm {
class FunctionType;
-class ParamAttrsList;
// Traits for intrusive list of instructions...
template<> struct ilist_traits<BasicBlock>
@@ -69,7 +68,7 @@ private:
BasicBlockListType BasicBlocks; ///< The basic blocks
mutable ArgumentListType ArgumentList; ///< The formal arguments
ValueSymbolTable *SymTab; ///< Symbol table of args/instructions
- const ParamAttrsList *ParamAttrs; ///< Parameter attributes
+ PAListPtr ParamAttrs; ///< Parameter attributes
// The Calling Convention is stored in Value::SubclassData.
/*unsigned CallingConvention;*/
@@ -145,16 +144,11 @@ public:
SubclassData = (SubclassData & 1) | (CC << 1);
}
- /// Obtains a constant pointer to the ParamAttrsList object which holds the
- /// parameter attributes information, if any.
- /// @returns 0 if no parameter attributes have been set.
- /// @brief Get the parameter attributes.
- const ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
-
- /// Sets the parameter attributes for this Function. To construct a
- /// ParamAttrsList, see ParameterAttributes.h
- /// @brief Set the parameter attributes.
- void setParamAttrs(const ParamAttrsList *attrs);
+ /// getParamAttrs - Return the parameter attributes for this function.
+ const PAListPtr &getParamAttrs() const { return ParamAttrs; }
+
+ /// setParamAttrs - Set the parameter attributes for this Function.
+ void setParamAttrs(const PAListPtr &attrs) { ParamAttrs = attrs; }
/// hasCollector/getCollector/setCollector/clearCollector - The name of the
/// garbage collection algorithm to use during code generation.