source: icGREP/icgrep-devel/icgrep/lz4/LZ4Generator.h @ 5864

Last change on this file since 5864 was 5864, checked in by xwa163, 15 months ago

Add LZ4D extract deposit related kernel, target and test cases

File size: 2.1 KB
Line 
1
2#ifndef ICGREP_LZ4GENERATOR_H
3#define ICGREP_LZ4GENERATOR_H
4#include <llvm/IR/Module.h>
5#include <llvm/IR/Function.h>
6
7#include <llvm/Support/Signals.h>
8#include <llvm/Support/ManagedStatic.h>
9#include <IR_Gen/idisa_target.h>
10
11#include <toolchain/toolchain.h>
12
13#include <toolchain/cpudriver.h>
14#include <string>
15
16namespace re { class CC; }
17
18
19typedef void (*MainFunctionType)(char * byte_data, size_t headerSize, size_t filesize, bool hasBlockChecksum);
20
21class LZ4Generator {
22
23public:
24    LZ4Generator();
25
26    MainFunctionType getMainFunc();
27
28    void generatePipeline(const std::string& outputFile);
29    void generateExtractOnlyPipeline(const std::string& outputFile);
30
31private:
32    //// Private Method
33    inline void generateMainFunc(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
34    // Pipeline
35    inline void generateLoadByteStreamAndBitStream(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
36    inline void generateExtractAndDepositMarkers(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
37    inline std::pair<parabix::StreamSetBuffer*, parabix::StreamSetBuffer*> generateSwizzleExtractData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
38    inline parabix::StreamSetBuffer* generateDepositData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder, parabix::StreamSetBuffer* swizzleBuffer);
39
40    // BufferSize related Helper Function
41    inline int getInputBufferBlocks();
42    inline int getDecompressedBufferBlocks();
43
44    //// Data Member
45    // Driver
46    ParabixDriver pxDriver;
47
48    // Runtime Arguments
49    llvm::Value * inputStream;
50    llvm::Value * headerSize;
51    llvm::Value * fileSize;
52    llvm::Value * hasBlockChecksum;
53
54
55    // StreamSetBuffers
56    parabix::StreamSetBuffer * ByteStream;
57    parabix::StreamSetBuffer * BasisBits;
58    parabix::StreamSetBuffer * EMarker; //TODO rename to ExtarctMarker
59    parabix::StreamSetBuffer * DepositMarker;
60    parabix::StreamSetBuffer * Match_Offset;
61
62    parabix::StreamSetBuffer * M0_Start;  // TODO M0_Start and M0_End should be changed to Deposit_Start and Deposit_End
63    parabix::StreamSetBuffer * M0_End;
64};
65
66
67#endif //ICGREP_LZ4GENERATOR_H
Note: See TracBrowser for help on using the repository browser.