source: icGREP/icgrep-devel/icgrep/toolchain/cpudriver.h @ 5735

Last change on this file since 5735 was 5735, checked in by cameron, 15 months ago

Incremental object caching; multithreaded print

File size: 1.8 KB
Line 
1#ifndef CPUDRIVER_H
2#define CPUDRIVER_H
3#include "driver.h"
4
5namespace llvm { class ExecutionEngine; }
6namespace llvm { class TargetMachine; }
7namespace llvm { class raw_fd_ostream; }
8
9class ParabixObjectCache;
10
11class ParabixDriver final : public Driver {
12    friend class CBuilder;
13public:
14    ParabixDriver(std::string && moduleName);
15
16    ~ParabixDriver();
17
18    void generatePipelineIR() override;
19
20    void makeKernelCall(kernel::Kernel * kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs) override;
21
22    void finalizeObject() override;
23
24    bool hasExternalFunction(const llvm::StringRef functionName) const override;
25
26    void * getMain() override; // "main" exists until the driver is deleted
27   
28    void performIncrementalCacheCleanupStep() override;
29
30private:
31
32    llvm::Function * addLinkFunction(llvm::Module * mod, llvm::StringRef name, llvm::FunctionType * type, void * functionPtr) const override;
33
34private:
35    llvm::TargetMachine *                                   mTarget;
36    llvm::ExecutionEngine *                                 mEngine;
37    ParabixObjectCache *                                    mCache;
38    std::vector<kernel::Kernel *>                           mUncachedKernel;
39    // NOTE: when printing the IR/ASM, we cannot assume they're completely finished after finalizeObject is executed. Instead we store a
40    // pointer and delete them once the driver (and any processing) is complete. This prevents us from reclaiming the memory early but
41    // also avoids a potential segmentation fault when writing large files.
42    llvm::raw_fd_ostream *                                  mIROutputStream;
43    llvm::raw_fd_ostream *                                  mASMOutputStream;
44};
45
46#endif // CPUDRIVER_H
Note: See TracBrowser for help on using the repository browser.