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

Last change on this file since 5921 was 5921, checked in by xwa163, 13 months ago
  1. Initial checkin for new approach for lz4 index decoder that always use 4MB buffer
  2. Add test case for new approach (for now test cases will fail when test file is larger than 4MB)
File size: 2.0 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    void generateExtractAndDepositOnlyPipeline(const std::string& outputFile);
31
32protected:
33    //// Protected Method
34    inline void generateMainFunc(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
35    // Pipeline
36    virtual void generateLoadByteStreamAndBitStream(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
37    virtual void generateExtractAndDepositMarkers(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
38    virtual std::pair<parabix::StreamSetBuffer*, parabix::StreamSetBuffer*> generateSwizzleExtractData(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
39
40    // BufferSize related Helper Function
41    virtual int getInputBufferBlocks();
42    virtual int getDecompressedBufferBlocks();
43
44
45    //// Data Member
46    // Driver
47    ParabixDriver pxDriver;
48
49    // Runtime Arguments
50    llvm::Value * inputStream;
51    llvm::Value * headerSize;
52    llvm::Value * fileSize;
53    llvm::Value * hasBlockChecksum;
54
55
56    // StreamSetBuffers
57    parabix::StreamSetBuffer * ByteStream;
58    parabix::StreamSetBuffer * BasisBits;
59    parabix::StreamSetBuffer * EMarker; //TODO rename to ExtarctMarker
60    parabix::StreamSetBuffer * DepositMarker;
61    parabix::StreamSetBuffer * Match_Offset;
62
63    parabix::StreamSetBuffer * M0_Start;  // TODO M0_Start and M0_End should be changed to Deposit_Start and Deposit_End
64    parabix::StreamSetBuffer * M0_End;
65};
66
67
68#endif //ICGREP_LZ4GENERATOR_H
Note: See TracBrowser for help on using the repository browser.