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

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

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

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