diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-02-25 11:32:15 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-02-25 11:32:15 -0500 |
commit | 28b48f7018b72a80b202ad4c76a1e954d2f9174e (patch) | |
tree | 61b1166462bb5ceddd0c194b032c6aaaf0891df4 | |
parent | 6c04161dc83835753996a7fa7e7a9b0e542d1267 (diff) |
cache llvm-nm results
-rw-r--r-- | tools/shared.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/shared.py b/tools/shared.py index ebf803da..3e6d487b 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -866,8 +866,14 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e assert os.path.exists(output_filename), 'Could not create bc file: ' + output return output_filename + nm_cache = {} # cache results of nm - it can be slow to run + @staticmethod def llvm_nm(filename, stdout=PIPE, stderr=None): + if filename in Building.nm_cache: + if DEBUG: print >> sys.stderr, 'loading nm results for %s from cache' % filename + return Building.nm_cache[filename] + # LLVM binary ==> list of symbols output = Popen([LLVM_NM, filename], stdout=stdout, stderr=stderr).communicate()[0] class ret: @@ -888,6 +894,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e ret.defs = set(ret.defs) ret.undefs = set(ret.undefs) ret.commons = set(ret.commons) + Building.nm_cache[filename] = ret return ret @staticmethod |