Chromium Code Reviews

Unified Diff: lib/Bitcode/NaCl/Writer/NaClValueEnumerator.h

Issue 14495008: Create type IDs based on reference counts. (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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);
« no previous file with comments | « no previous file | lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp » ('j') | lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp » ('J')

Powered by Google App Engine