source: icGREP/icgrep-devel/icgrep/kernels/radix64.h @ 5260

Last change on this file since 5260 was 5260, checked in by nmedfort, 9 months ago

Changes working towards simplifying accessing stream elements + some modifications to simplify include / forward declarations within the CodeGen? library.

File size: 2.2 KB
Line 
1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5#ifndef RADIX64_H
6#define RADIX64_H
7
8#include "streamset.h"
9#include "interface.h"
10#include "kernel.h"
11
12namespace llvm { class Module; }
13namespace llvm { class Value; }
14
15namespace IDISA { class IDISA_Builder; }
16
17namespace kernel {
18
19/*  expand3_4 transforms a byte sequence by duplicating every third byte.
20    Each 3 bytes of the input abc produces a 4 byte output abcc.   
21    This is a useful preparatory transformation in various radix-64 encodings. */
22 
23class expand3_4Kernel : public KernelBuilder {
24public:
25   
26    expand3_4Kernel(IDISA::IDISA_Builder * iBuilder) :
27    KernelBuilder(iBuilder, "expand3_4",
28                  {Binding{iBuilder->getStreamSetTy(1, 8), "sourceStream"}},
29                  {Binding{iBuilder->getStreamSetTy(1, 8), "expandedStream"}},
30                  {}, {}, {}) {}
31   
32private:
33    void generateDoBlockMethod() const override;
34    void generateDoSegmentMethod() const override;
35   
36};
37
38class radix64Kernel : public KernelBuilder {
39public:
40   
41    radix64Kernel(IDISA::IDISA_Builder * iBuilder) :
42    KernelBuilder(iBuilder, "radix64",
43                  {Binding{iBuilder->getStreamSetTy(1, 8), "expandedStream"}},
44                  {Binding{iBuilder->getStreamSetTy(1, 8), "radix64stream"}},
45                  {}, {}, {}) {}
46
47private:
48    virtual void generateDoBlockLogic(llvm::Value * self, llvm::Value * blockNo) const override;
49    virtual void generateDoBlockMethod() const override;
50    virtual void generateFinalBlockMethod() const override;
51};
52
53class base64Kernel : public KernelBuilder {
54public:
55   
56    base64Kernel(IDISA::IDISA_Builder * iBuilder) :
57    KernelBuilder(iBuilder, "base64",
58                  {Binding{iBuilder->getStreamSetTy(1, 8), "radix64stream"}},
59                  {Binding{iBuilder->getStreamSetTy(1, 8), "base64stream"}},
60                  {}, {}, {}) {}
61   
62private:
63    virtual void generateDoBlockLogic(llvm::Value * self, llvm::Value * blockNo) const override;
64    virtual void generateFinalBlockMethod() const override;
65    virtual void generateDoBlockMethod() const override;
66   
67};
68
69}
70#endif
Note: See TracBrowser for help on using the repository browser.