source: icGREP/icgrep-devel/icgrep/IDISA/idisa_nvptx_builder.h @ 5175

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

Some tidy ups and changes to prepare for LLVM 3.9

File size: 2.3 KB
Line 
1#ifndef IDISA_NVPTX_BUILDER_H
2#define IDISA_NVPTX_BUILDER_H
3
4/*
5 *  Copyright (c) 2015 International Characters.
6 *  This software is licensed to the public under the Open Software License 3.0.
7*/
8
9#include <IDISA/idisa_builder.h>
10#include <IDISA/idisa_i64_builder.h>
11#include <iostream>
12using namespace llvm;
13
14namespace IDISA {
15
16class IDISA_NVPTX20_Builder : public IDISA_I64_Builder {
17public:
18   
19    IDISA_NVPTX20_Builder(Module * m, int groupSize)
20    : IDISA_I64_Builder(m, VectorType::get(IntegerType::get(m->getContext(), 64), 1))
21    , groupThreads(groupSize)
22    {
23        mStride = mBitBlockWidth * groupSize;
24        CreateGlobals();
25        CreateBuiltinFunctions();
26        CreateLongAdvanceFunc();
27        CreateLongAddFunc();
28        CreateBallotFunc();
29    }
30   
31    ~IDISA_NVPTX20_Builder() {};
32
33    int getGroupThreads();
34   
35    Value * bitblock_any(Value * a) override;
36    std::pair<Value *, Value *> bitblock_add_with_carry(Value * a, Value * b, Value * carryin) override;
37    virtual std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) override;
38    Value * bitblock_mask_from(Value * pos) override;
39    Value * bitblock_set_bit(Value * pos) override;
40
41    Value * getEOFMask(Value * remainingBytes);
42
43    Value * Advance(const unsigned index, const unsigned shiftAmount, Value * const value);
44    Value * LongAdd(Value * const valA, Value * const valB, Value * carryIn);
45
46
47private:
48    void CreateGlobals();
49    void CreateBuiltinFunctions();
50    void CreateLongAdvanceFunc();
51    void CreateLongAddFunc();
52    void CreateBallotFunc();
53
54    int                                 groupThreads;
55    Function *                          barrierFunc;
56    Function *                          tidFunc;
57    Function *                          mLongAdvanceFunc;
58    Function *                          mLongAddFunc;
59    GlobalVariable*                     carry;
60    GlobalVariable*                     bubble;
61};
62
63#if 0
64
65class IDISA_NVPTX35_Builder : public IDISA_NVPTX20_Builder {
66    IDISA_NVPTX35_Builder(Module * m, int groupSize) : IDISA_NVPTX30_Builder(m, groupSize) {}
67   
68    std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) override;
69
70    ~IDISA_NVPTX35_Builder() {};
71
72};
73#endif   
74   
75}
76#endif // IDISA_NVPTX_BUILDER_H
Note: See TracBrowser for help on using the repository browser.