source: icGREP/icgrep-devel/icgrep/toolchain.h @ 5391

Last change on this file since 5391 was 5391, checked in by cameron, 2 years ago

ParabixDriver/ObjectCache? separate compilation and linking: initial check-in with wc

File size: 2.2 KB
Line 
1/*
2 *  Copyright (c) 2017 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef TOOLCHAIN_H
8#define TOOLCHAIN_H
9#include <string>
10#include <IR_Gen/idisa_builder.h>
11#include <object_cache.h>
12
13namespace llvm { class ExecutionEngine; }
14namespace llvm { class Module; }
15namespace llvm { namespace cl { class OptionCategory; } }
16namespace IDISA { class IDISA_Builder; }
17namespace kernel { class KernelBuilder; }
18namespace parabix { class StreamSetBuffer; }
19
20namespace codegen {
21const llvm::cl::OptionCategory * codegen_flags();
22
23// Command Parameters
24enum DebugFlags {
25    ShowIR,
26#if LLVM_VERSION_MINOR > 6
27    ShowASM,
28#endif
29    SerializeThreads
30};
31
32bool DebugOptionIsSet(DebugFlags flag);
33
34
35extern char OptLevel;  // set from command line
36extern int BlockSize;  // set from command line
37extern int SegmentSize;  // set from command line
38extern int BufferSegments;
39extern int ThreadNum;
40extern bool EnableAsserts;
41#ifdef CUDA_ENABLED
42extern bool NVPTX;
43extern int GroupNum;
44#endif
45}
46
47#ifdef CUDA_ENABLED
48void setNVPTXOption();
49void Compile2PTX (llvm::Module * m, std::string IRFilename, std::string PTXFilename);
50#endif
51
52void AddParabixVersionPrinter();
53
54bool AVX2_available();
55
56llvm::ExecutionEngine * JIT_to_ExecutionEngine (llvm::Module * m);
57
58void ApplyObjectCache(llvm::ExecutionEngine * e);
59
60void generatePipeline(IDISA::IDISA_Builder * iBuilder, const std::vector<kernel::KernelBuilder *> & kernels);
61
62
63class ParabixDriver {
64public:
65    ParabixDriver(IDISA::IDISA_Builder * iBuilder);
66   
67    IDISA::IDISA_Builder * getIDISA_Builder() {return iBuilder;}
68   
69    void JITcompileMain ();
70   
71    void addKernelCall(kernel::KernelBuilder & kb, const std::vector<parabix::StreamSetBuffer *> & inputs, const std::vector<parabix::StreamSetBuffer *> & outputs);
72   
73    void generatePipelineIR();
74   
75    void linkAndFinalize();
76   
77    void * getPointerToMain();
78
79   
80private:
81    llvm::Module * mMainModule;
82    IDISA::IDISA_Builder * iBuilder;
83    std::unique_ptr<ParabixObjectCache> mCache;
84    //std::unique_ptr<llvm::ExecutionEngine> mEngine;
85    llvm::ExecutionEngine * mEngine;
86    std::vector<kernel::KernelBuilder *> mKernelList;
87};
88#endif
Note: See TracBrowser for help on using the repository browser.