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

Last change on this file since 5257 was 5246, checked in by nmedfort, 3 years ago

Code clean up to enforce proper calling order of KernelBuilder? methods

File size: 2.1 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; }
13
14namespace IDISA { class IDISA_Builder; }
15
16namespace kernel {
17
18/*  expand3_4 transforms a byte sequence by duplicating every third byte.
19    Each 3 bytes of the input abc produces a 4 byte output abcc.   
20    This is a useful preparatory transformation in various radix-64 encodings. */
21 
22class expand3_4Kernel : public KernelBuilder {
23public:
24   
25    expand3_4Kernel(IDISA::IDISA_Builder * iBuilder) :
26    KernelBuilder(iBuilder, "expand3_4",
27                  {Binding{iBuilder->getStreamSetTy(1, 8), "sourceStream"}},
28                  {Binding{iBuilder->getStreamSetTy(1, 8), "expandedStream"}},
29                  {}, {}, {}) {}
30   
31private:
32    void generateDoBlockMethod() const override;
33    void generateDoSegmentMethod() const override;
34   
35};
36
37class radix64Kernel : public KernelBuilder {
38public:
39   
40    radix64Kernel(IDISA::IDISA_Builder * iBuilder) :
41    KernelBuilder(iBuilder, "radix64",
42                  {Binding{iBuilder->getStreamSetTy(1, 8), "expandedStream"}},
43                  {Binding{iBuilder->getStreamSetTy(1, 8), "radix64stream"}},
44                  {}, {}, {}) {}
45
46private:
47    virtual void generateDoBlockLogic(Value * self, Value * blockNo) const override;
48    virtual void generateDoBlockMethod() const override;
49    virtual void generateFinalBlockMethod() const override;
50};
51
52class base64Kernel : public KernelBuilder {
53public:
54   
55    base64Kernel(IDISA::IDISA_Builder * iBuilder) :
56    KernelBuilder(iBuilder, "base64",
57                  {Binding{iBuilder->getStreamSetTy(1, 8), "radix64stream"}},
58                  {Binding{iBuilder->getStreamSetTy(1, 8), "base64stream"}},
59                  {}, {}, {}) {}
60   
61private:
62    virtual void generateDoBlockLogic(Value * self, Value * blockNo) const override;
63    virtual void generateFinalBlockMethod() const override;
64    virtual void generateDoBlockMethod() const override;
65   
66};
67
68}
69#endif
Note: See TracBrowser for help on using the repository browser.