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

Last change on this file since 5463 was 5458, checked in by lindanl, 2 years ago

Add NVPTX driver.

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