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

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

Bug fix for memory check and issues found parsing internal 'files'. Added backtrace option from execinfo.h

File size: 3.3 KB
RevLine 
[5128]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
[5238]9#include <IR_Gen/idisa_i64_builder.h>
[5260]10
[5128]11namespace IDISA {
12
13class IDISA_NVPTX20_Builder : public IDISA_I64_Builder {
14public:
15   
[5489]16    IDISA_NVPTX20_Builder(llvm::LLVMContext & C, unsigned vectorWidth, unsigned stride)
17    : IDISA_Builder(C, vectorWidth, stride)
18    , IDISA_I64_Builder(C, vectorWidth, stride)
19    , groupThreads(stride / vectorWidth)
[5486]20    , barrierFunc(nullptr)
21    , tidFunc(nullptr)
22    , mLongAdvanceFunc(nullptr)
23    , mLongAddFunc(nullptr)
24    , carry(nullptr)
25    , bubble(nullptr) {
[5489]26        assert ((stride % vectorWidth) == 0);
[5458]27    }
28
29    ~IDISA_NVPTX20_Builder() {}
[5464]30
[5458]31    virtual std::string getBuilderUniqueName() override;
[5464]32
[5486]33    unsigned getGroupThreads() const;
[5458]34
[5464]35    void CreateBaseFunctions() override;
[5128]36   
[5464]37    llvm::Value * bitblock_any(llvm::Value * a) override;
38    std::pair<llvm::Value *, llvm::Value *> bitblock_add_with_carry(llvm::Value * a, llvm::Value * b, llvm::Value * carryin) override;
39    virtual std::pair<llvm::Value *, llvm::Value *> bitblock_advance(llvm::Value * a, llvm::Value * shiftin, unsigned shift) override;
40    llvm::Value * bitblock_mask_from(llvm::Value * pos) override;
41    llvm::Value * bitblock_set_bit(llvm::Value * pos) override;
[5128]42
[5464]43    llvm::Value * getEOFMask(llvm::Value * remainingBytes);
[5128]44
[5464]45    llvm::Value * Advance(const unsigned index, const unsigned shiftAmount, llvm::Value * const value);
46    llvm::Value * LongAdd(llvm::Value * const valA, llvm::Value * const valB, llvm::Value * carryIn);
[5128]47
[5464]48    llvm::LoadInst * CreateAtomicLoadAcquire(llvm::Value * ptr) override;
49    llvm::StoreInst * CreateAtomicStoreRelease(llvm::Value * val, llvm::Value * ptr) override;
[5128]50
[5435]51    bool supportsIndirectBr() const final {
52        return false;
53    }
54
[5486]55    #ifdef HAS_ADDRESS_SANITIZER
56    llvm::LoadInst * CreateLoad(llvm::Value *Ptr, const char *Name) override;
57
58    llvm::LoadInst * CreateLoad(llvm::Value *Ptr, const llvm::Twine &Name = "") override;
59
60    llvm::LoadInst * CreateLoad(llvm::Type *Ty, llvm::Value *Ptr, const llvm::Twine &Name = "") override;
61
62    llvm::LoadInst * CreateLoad(llvm::Value *Ptr, bool isVolatile, const llvm::Twine &Name = "") override;
63
64    llvm::StoreInst * CreateStore(llvm::Value *Val, llvm::Value *Ptr, bool isVolatile = false) override;
65    #endif
66
[5128]67private:
[5464]68
[5128]69    void CreateGlobals();
70    void CreateBuiltinFunctions();
71    void CreateLongAdvanceFunc();
72    void CreateLongAddFunc();
[5165]73    void CreateBallotFunc();
[5128]74
[5464]75private:
[5486]76    const unsigned              groupThreads;
[5464]77    llvm::Function *            barrierFunc;
78    llvm::Function *            tidFunc;
79    llvm::Function *            mLongAdvanceFunc;
80    llvm::Function *            mLongAddFunc;
81    llvm::GlobalVariable*       carry;
82    llvm::GlobalVariable*       bubble;
[5128]83};
84
85#if 0
86
87class IDISA_NVPTX35_Builder : public IDISA_NVPTX20_Builder {
88    IDISA_NVPTX35_Builder(Module * m, int groupSize) : IDISA_NVPTX30_Builder(m, groupSize) {}
89   
[5464]90    std::pair<llvm::Value *, llvm::Value *> bitblock_advance(llvm::Value * a, llvm::Value * shiftin, unsigned shift) override;
[5128]91
92    ~IDISA_NVPTX35_Builder() {};
[5374]93    virtual std::string getBuilderUniqueName() override;
[5128]94};
95#endif   
96   
97}
98#endif // IDISA_NVPTX_BUILDER_H
Note: See TracBrowser for help on using the repository browser.