[llvm-commits] CVS: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp Writer.cpp
Chris Lattner
sabre at nondot.org
Wed Apr 25 19:47:04 PDT 2007
Changes in directory llvm/lib/Bitcode/Writer:
ValueEnumerator.cpp updated: 1.2 -> 1.3
Writer.cpp updated: 1.8 -> 1.9
---
Log message:
add bitcode alias support
---
Diffs of the changes: (+22 -0)
ValueEnumerator.cpp | 10 ++++++++++
Writer.cpp | 12 ++++++++++++
2 files changed, 22 insertions(+)
Index: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
diff -u llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.2 llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.3
--- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.2 Mon Apr 23 19:16:04 2007
+++ llvm/lib/Bitcode/Writer/ValueEnumerator.cpp Wed Apr 25 21:46:40 2007
@@ -28,12 +28,22 @@
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
EnumerateValue(I);
+ // Enumerate the aliases.
+ for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end();
+ I != E; ++I)
+ EnumerateValue(I);
+
// Enumerate the global variable initializers.
for (Module::const_global_iterator I = M->global_begin(),
E = M->global_end(); I != E; ++I)
if (I->hasInitializer())
EnumerateValue(I->getInitializer());
+ // Enumerate the aliasees.
+ for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end();
+ I != E; ++I)
+ EnumerateValue(I->getAliasee());
+
// FIXME: Implement the 'string constant' optimization.
// Enumerate types used by the type symbol table.
Index: llvm/lib/Bitcode/Writer/Writer.cpp
diff -u llvm/lib/Bitcode/Writer/Writer.cpp:1.8 llvm/lib/Bitcode/Writer/Writer.cpp:1.9
--- llvm/lib/Bitcode/Writer/Writer.cpp:1.8 Tue Apr 24 02:07:11 2007
+++ llvm/lib/Bitcode/Writer/Writer.cpp Wed Apr 25 21:46:40 2007
@@ -309,6 +309,18 @@
Stream.EmitRecord(bitc::MODULE_CODE_FUNCTION, Vals, AbbrevToUse);
Vals.clear();
}
+
+
+ // Emit the alias information.
+ for (Module::const_alias_iterator AI = M->alias_begin(), E = M->alias_end();
+ AI != E; ++AI) {
+ Vals.push_back(VE.getTypeID(AI->getType()));
+ Vals.push_back(VE.getValueID(AI->getAliasee()));
+ Vals.push_back(getEncodedLinkage(AI));
+ unsigned AbbrevToUse = 0;
+ Stream.EmitRecord(bitc::MODULE_CODE_ALIAS, Vals, AbbrevToUse);
+ Vals.clear();
+ }
}
More information about the llvm-commits
mailing list