![]() |
chigraph
master
Systems programming language written for beginners in LLVM
|
Public Member Functions | |
DefaultModuleCache (Context &ctx) | |
Default constrcutor. More... | |
Result | cacheModule (const boost::filesystem::path &moduleName, llvm::Module &compiledModule, std::time_t timeAtFileRead) override |
Cache a module. More... | |
boost::filesystem::path | cachePathForModule (const boost::filesystem::path &moduleName) const |
Get the cache name for a module. More... | |
std::time_t | cacheUpdateTime (const boost::filesystem::path &moduleName) const override |
Get the time that a cache was updated. More... | |
Context & | context () const |
Get the context this cache is bound to. More... | |
void | invalidateCache (const boost::filesystem::path &moduleName) override |
std::unique_ptr< llvm::Module > | retrieveFromCache (const boost::filesystem::path &moduleName, std::time_t atLeastThisNew) override |
Retrieve a module from the cache. More... | |
Definition at line 10 of file DefaultModuleCache.hpp.
chi::DefaultModuleCache::DefaultModuleCache | ( | chi::Context & | ctx | ) |
Default constrcutor.
ctx | The context to cache for |
Definition at line 26 of file DefaultModuleCache.cpp.
|
overridevirtual |
Cache a module.
moduleName | The name of the module to cache |
!moduleName.empty()
compiledModule | The IR that's been compiled from this module |
timeAtFileRead | The time to store as the cache time. Should be the time the module was read from disk |
Implements chi::ModuleCache.
Definition at line 28 of file DefaultModuleCache.cpp.
References cachePathForModule().
boost::filesystem::path chi::DefaultModuleCache::cachePathForModule | ( | const boost::filesystem::path & | moduleName | ) | const |
Get the cache name for a module.
Basically context().workspacePath() / moduleName + ".bc"
moduleName | The name of the module to get a cache path for |
Definition at line 70 of file DefaultModuleCache.cpp.
References chi::ModuleCache::context(), and chi::Context::workspacePath().
Referenced by cacheModule(), cacheUpdateTime(), invalidateCache(), and retrieveFromCache().
|
overridevirtual |
Get the time that a cache was updated.
moduleName | The module to get the last update time for |
Implements chi::ModuleCache.
Definition at line 83 of file DefaultModuleCache.cpp.
References cachePathForModule().
Referenced by retrieveFromCache().
|
inlineinherited |
Get the context this cache is bound to.
Context
Definition at line 59 of file ModuleCache.hpp.
Referenced by cachePathForModule(), and retrieveFromCache().
|
overridevirtual |
Implements chi::ModuleCache.
Definition at line 75 of file DefaultModuleCache.cpp.
References cachePathForModule().
|
overridevirtual |
Retrieve a module from the cache.
moduleName | The name of the module to retrieve |
!moduleName.empty()
atLeastThisNew | Make sure the cache is at least as new as this |
Implements chi::ModuleCache.
Definition at line 87 of file DefaultModuleCache.cpp.
References cachePathForModule(), cacheUpdateTime(), chi::ModuleCache::context(), and chi::parseBitcodeFile().