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

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

Refine path representation and default CacheDir?

File size: 810 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#include <llvm/ADT/SmallString.h>
10
11class ICGrepObjectCache : public llvm::ObjectCache {
12    public:
13        ICGrepObjectCache(const std::string &dir);
14        ICGrepObjectCache();
15        virtual ~ICGrepObjectCache();
16
17        void notifyObjectCompiled(const llvm::Module *M, llvm::MemoryBufferRef Obj) override;
18        std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module* M) override;
19
20    private:
21        const static size_t mPathInitLength = 256;
22        typedef llvm::SmallString<mPathInitLength> Path;
23        Path CacheDir;
24
25        bool getCacheFilename(const std::string &ModID, Path &CacheName);
26};
27
28#endif
Note: See TracBrowser for help on using the repository browser.