summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer/ValueEnumerator.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
commit8a923e7c288cf383c2d44a23080d02579126c0a0 (patch)
tree528109f8de22bcc7ff4a60c0323b5722be9a8919 /llvm/lib/Bitcode/Writer/ValueEnumerator.h
parentb327e490473fdf5673e4ae5641f9f1b60a8c5f61 (diff)
downloadbcm5719-llvm-8a923e7c288cf383c2d44a23080d02579126c0a0.tar.gz
bcm5719-llvm-8a923e7c288cf383c2d44a23080d02579126c0a0.zip
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. llvm-svn: 48289
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.h')
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.h b/llvm/lib/Bitcode/Writer/ValueEnumerator.h
index 9fb916a5158..dc40d016dca 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.h
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.h
@@ -15,6 +15,7 @@
#define VALUE_ENUMERATOR_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ParameterAttributes.h"
#include <vector>
namespace llvm {
@@ -24,7 +25,7 @@ class Value;
class BasicBlock;
class Function;
class Module;
-class ParamAttrsList;
+class PAListPtr;
class TypeSymbolTable;
class ValueSymbolTable;
@@ -44,9 +45,9 @@ private:
ValueMapType ValueMap;
ValueList Values;
- typedef DenseMap<const ParamAttrsList*, unsigned> ParamAttrMapType;
+ typedef DenseMap<void*, unsigned> ParamAttrMapType;
ParamAttrMapType ParamAttrMap;
- std::vector<const ParamAttrsList*> ParamAttrs;
+ std::vector<PAListPtr> ParamAttrs;
/// BasicBlocks - This contains all the basic blocks for the currently
/// incorporated function. Their reverse mapping is stored in ValueMap.
@@ -75,9 +76,9 @@ public:
return I->second-1;
}
- unsigned getParamAttrID(const ParamAttrsList *PAL) const {
- if (PAL == 0) return 0; // Null maps to zero.
- ParamAttrMapType::const_iterator I = ParamAttrMap.find(PAL);
+ unsigned getParamAttrID(const PAListPtr &PAL) const {
+ if (PAL.isEmpty()) return 0; // Null maps to zero.
+ ParamAttrMapType::const_iterator I = ParamAttrMap.find(PAL.getRawPointer());
assert(I != ParamAttrMap.end() && "ParamAttr not in ValueEnumerator!");
return I->second;
}
@@ -94,7 +95,7 @@ public:
const std::vector<const BasicBlock*> &getBasicBlocks() const {
return BasicBlocks;
}
- const std::vector<const ParamAttrsList*> &getParamAttrs() const {
+ const std::vector<PAListPtr> &getParamAttrs() const {
return ParamAttrs;
}
@@ -115,7 +116,7 @@ private:
void EnumerateValue(const Value *V);
void EnumerateType(const Type *T);
void EnumerateOperandType(const Value *V);
- void EnumerateParamAttrs(const ParamAttrsList *PAL);
+ void EnumerateParamAttrs(const PAListPtr &PAL);
void EnumerateTypeSymbolTable(const TypeSymbolTable &ST);
void EnumerateValueSymbolTable(const ValueSymbolTable &ST);
OpenPOWER on IntegriCloud