source: icGREP/icgrep-devel/icgrep/IR_Gen/idisa_nvptx_builder.h @ 5436

Last change on this file since 5436 was 5436, checked in by nmedfort, 2 years ago

Continued refactoring work. PabloKernel? now abstract base type with a 'generatePabloMethod' hook to generate Pablo code.

File size: 2.6 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 <IR_Gen/idisa_i64_builder.h>
10
11using namespace llvm;
12
13namespace IDISA {
14
15class IDISA_NVPTX20_Builder : public IDISA_I64_Builder {
16public:
17   
18    IDISA_NVPTX20_Builder(llvm::LLVMContext & C, unsigned registerWidth, unsigned vectorWidth, unsigned groupSize)
19    : IDISA_Builder(C, registerWidth, registerWidth, (vectorWidth * groupSize))
20    , IDISA_I64_Builder(C, registerWidth, registerWidth, (vectorWidth * groupSize))
21    , groupThreads(groupSize) {
22        CreateGlobals();
23        CreateBuiltinFunctions();
24        CreateLongAdvanceFunc();
25        CreateLongAddFunc();
26        CreateBallotFunc();
27    }
28   
29    ~IDISA_NVPTX20_Builder() {}
30    virtual std::string getBuilderUniqueName() override;
31    int getGroupThreads();
32   
33    Value * bitblock_any(Value * a) override;
34    std::pair<Value *, Value *> bitblock_add_with_carry(Value * a, Value * b, Value * carryin) override;
35    virtual std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) override;
36    Value * bitblock_mask_from(Value * pos) override;
37    Value * bitblock_set_bit(Value * pos) override;
38
39    Value * getEOFMask(Value * remainingBytes);
40
41    Value * Advance(const unsigned index, const unsigned shiftAmount, Value * const value);
42    Value * LongAdd(Value * const valA, Value * const valB, Value * carryIn);
43
44    LoadInst * CreateAtomicLoadAcquire(Value * ptr) override;
45    StoreInst * CreateAtomicStoreRelease(Value * val, Value * ptr) override; 
46
47    bool supportsIndirectBr() const final {
48        return false;
49    }
50
51private:
52    void CreateGlobals();
53    void CreateBuiltinFunctions();
54    void CreateLongAdvanceFunc();
55    void CreateLongAddFunc();
56    void CreateBallotFunc();
57
58    int                                 groupThreads;
59    Function *                          barrierFunc;
60    Function *                          tidFunc;
61    Function *                          mLongAdvanceFunc;
62    Function *                          mLongAddFunc;
63    GlobalVariable*                     carry;
64    GlobalVariable*                     bubble;
65};
66
67#if 0
68
69class IDISA_NVPTX35_Builder : public IDISA_NVPTX20_Builder {
70    IDISA_NVPTX35_Builder(Module * m, int groupSize) : IDISA_NVPTX30_Builder(m, groupSize) {}
71   
72    std::pair<Value *, Value *> bitblock_advance(Value * a, Value * shiftin, unsigned shift) override;
73
74    ~IDISA_NVPTX35_Builder() {};
75    virtual std::string getBuilderUniqueName() override;
76};
77#endif   
78   
79}
80#endif // IDISA_NVPTX_BUILDER_H
Note: See TracBrowser for help on using the repository browser.