diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-22 21:03:07 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-22 21:26:59 -0800 |
commit | ee2f1f7f40632e786c6e67c1fc82185d2fcafac2 (patch) | |
tree | 312723f7194c614d10d38384b49d7cdf8d294a0e /lib/Target/CppBackend/CPPBackend.cpp | |
parent | 6e9be94eee0bbd5b84048cf86d4b1565c4a79a4b (diff) |
use function alignment to pack function tables more efficiently
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index cd316762a4..a5a648105d 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -195,7 +195,10 @@ namespace { if (IndexedFunctions.find(Name) != IndexedFunctions.end()) return IndexedFunctions[Name]; std::string Sig = getFunctionSignature(F->getFunctionType()); FunctionTable &Table = FunctionTables[Sig]; - while (Table.size() == 0 || Table.size() % 2 == 1) Table.push_back("0"); // TODO: optimize this, fill in holes, see test_polymorph + // use alignment info to avoid unnecessary holes. This is not optimal though, + // (1) depends on order of appearance, and (2) really just need align for &class::method, see test_polymorph + unsigned Alignment = F->getAlignment() || 1; + while (Table.size() == 0 || Table.size() % Alignment) Table.push_back("0"); unsigned Index = Table.size(); Table.push_back(Name); IndexedFunctions[Name] = Index; |