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

Last change on this file since 5636 was 5630, checked in by nmedfort, 2 years ago

Partial check-in for avoidance of compiling Pablo/LLVM code to determine the Kernel struct type when using a cached object. Inactive RE alternation minimization check in.

File size: 1.7 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
28private:
29
30    llvm::Function * addLinkFunction(llvm::Module * mod, llvm::StringRef name, llvm::FunctionType * type, void * functionPtr) const override;
31
32private:
33    llvm::TargetMachine *                                   mTarget;
34    llvm::ExecutionEngine *                                 mEngine;
35    ParabixObjectCache *                                    mCache;
36    std::vector<kernel::Kernel *>                           mUncachedKernel;
37    // NOTE: when printing the IR/ASM, we cannot assume they're completely finished after finalizeObject is executed. Instead we store a
38    // pointer and delete them once the driver (and any processing) is complete. This prevents us from reclaiming the memory early but
39    // also avoids a potential segmentation fault when writing large files.
40    llvm::raw_fd_ostream *                                  mIROutputStream;
41    llvm::raw_fd_ostream *                                  mASMOutputStream;
42};
43
44#endif // CPUDRIVER_H
Note: See TracBrowser for help on using the repository browser.