Chromium Code Reviews| Index: lib/Bitcode/NaCl/Writer/NaClValueEnumerator.h |
| diff --git a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.h b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.h |
| index 9e9954883a61406ab6a946e552bf6ab93aed6a56..7fcfd27199e1a2b15a536838de21991ca964d8aa 100644 |
| --- a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.h |
| +++ b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.h |
| @@ -42,8 +42,17 @@ public: |
| // For each value, we remember its Value* and occurrence frequency. |
| typedef std::vector<std::pair<const Value*, unsigned> > ValueList; |
| private: |
| + // Defines unique ID's for each type. |
| typedef DenseMap<Type*, unsigned> TypeMapType; |
| TypeMapType TypeMap; |
| + // Defines the number of references to each type. If defined, |
| + // we are in the first pass of collecting types, and reference counts |
| + // should be added to the map. If undefined, we are in the second pass |
| + // that actually assigns type IDs, based on frequency counts found in |
| + // the first pass. |
| + typedef TypeMapType TypeCountMapType; |
| + TypeCountMapType* TypeCountMap; |
|
jvoung (off chromium)
2013/04/29 18:35:42
Does this need to be a pointer, or could it be all
Karl
2013/04/29 22:19:16
I did it this way because it is only needed during
|
| + |
| TypeList Types; |
| typedef DenseMap<const Value*, unsigned> ValueMapType; |
| @@ -83,6 +92,7 @@ private: |
| unsigned FirstFuncConstantID; |
| unsigned FirstInstID; |
| + unsigned FirstFloatTypeID; |
|
jvoung (off chromium)
2013/04/29 18:35:42
why are float types singled out?
Karl
2013/04/29 22:19:16
I was looking ahead to "float" operations, which c
|
| NaClValueEnumerator(const NaClValueEnumerator &) LLVM_DELETED_FUNCTION; |
| void operator=(const NaClValueEnumerator &) LLVM_DELETED_FUNCTION; |
| @@ -152,6 +162,7 @@ public: |
| void purgeFunction(); |
| private: |
| + void OptimizeTypes(const Module *M); |
|
jvoung (off chromium)
2013/04/29 18:35:42
This seems like a change that could be upstreamed.
Karl
2013/04/29 22:19:16
I agree that it is worth considering upstreaming t
|
| void OptimizeConstants(unsigned CstStart, unsigned CstEnd); |
| void EnumerateMDNodeOperands(const MDNode *N); |