source: icGREP/icgrep-devel/icgrep/object_cache.h @ 4962

Last change on this file since 4962 was 4962, checked in by hongpum, 3 years ago

Add basic object cache implementation

File size: 658 bytes
Line 
1#ifndef OBJECT_CACHE_H
2#define OBJECT_CACHE_H
3
4#include <string>
5
6#include <llvm/IR/Module.h>
7#include <llvm/Support/MemoryBuffer.h>
8#include <llvm/ExecutionEngine/ObjectCache.h>
9
10class ICGrepObjectCache : public llvm::ObjectCache {
11    public:
12        ICGrepObjectCache(const std::string& CacheDir);
13        virtual ~ICGrepObjectCache();
14
15        void notifyObjectCompiled(const llvm::Module *M, llvm::MemoryBufferRef Obj) override;
16        std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module* M) override;
17
18    private:
19        std::string CacheDir;
20
21        bool getCacheFilename(const std::string &ModID, std::string &CacheName);
22};
23
24#endif
Note: See TracBrowser for help on using the repository browser.