Ignore:
Timestamp:
May 6, 2017, 4:05:05 PM (2 years ago)
Author:
nmedfort
Message:

Continued refactoring work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5434 r5435  
    1010namespace IDISA { class IDISA_Builder; }
    1111namespace llvm { class Value; }
     12namespace kernel { class Kernel; }
    1213namespace kernel { class KernelBuilder; }
    1314
     
    1516   
    1617class StreamSetBuffer {
     18    friend class kernel::Kernel;
    1719    friend class kernel::KernelBuilder;
    18 
    1920public:
    2021
     
    5758    }
    5859
    59     virtual void allocateBuffer(IDISA::IDISA_Builder * const iBuilder);
     60    virtual void allocateBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder);
    6061
    6162    virtual void releaseBuffer(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const;
     
    8081    virtual llvm::Value * getLinearlyAccessibleBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const;
    8182   
     83    virtual void createBlockAlignedCopy(IDISA::IDISA_Builder * const iBuilder, llvm::Value * targetBlockPtr, llvm::Value * sourceBlockPtr, llvm::Value * itemsToCopy) const;
     84
    8285    virtual llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const;
    8386   
    8487    virtual llvm::Value * getLinearlyWritableBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const;
    8588   
    86     virtual void createBlockAlignedCopy(IDISA::IDISA_Builder * const iBuilder, llvm::Value * targetBlockPtr, llvm::Value * sourceBlockPtr, llvm::Value * itemsToCopy) const;
    87 
    88     virtual void reserveBytes(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * requested) const;
    89 
    9089    virtual ~StreamSetBuffer() = 0;
    9190
    92     kernel::KernelBuilder * getProducer() const {
     91    kernel::Kernel * getProducer() const {
    9392        return mProducer;
    9493    }
    9594
    96     const std::vector<kernel::KernelBuilder *> & getConsumers() const {
     95    const std::vector<kernel::Kernel *> & getConsumers() const {
    9796        return mConsumers;
    9897    }
     
    111110    virtual llvm::Value * getBaseAddress(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const;
    112111
    113     void setProducer(kernel::KernelBuilder * const producer) {
     112    void setProducer(kernel::Kernel * const producer) {
    114113        assert (producer);
    115114        mProducer = producer;
    116115    }
    117116
    118     void addConsumer(kernel::KernelBuilder * const consumer) {
     117    void addConsumer(kernel::Kernel * const consumer) {
    119118        assert (consumer);
    120119        mConsumers.push_back(consumer);
     
    129128    llvm::Type * const                      mBaseType;
    130129    std::string                             mUniqueID;
    131     kernel::KernelBuilder *                 mProducer;
    132     std::vector<kernel::KernelBuilder *>    mConsumers;
     130    kernel::Kernel *                 mProducer;
     131    std::vector<kernel::Kernel *>    mConsumers;
    133132};   
    134133
     
    139138    }   
    140139
    141     SingleBlockBuffer(IDISA::IDISA_Builder * b, llvm::Type * type);
     140    SingleBlockBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & b, llvm::Type * type);
    142141
    143142protected:
     
    152151    }
    153152
    154     SourceBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, unsigned AddressSpace = 0);
     153    SourceBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & b, llvm::Type * type, unsigned AddressSpace = 0);
    155154
    156155    void setBaseAddress(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * addr) const override;
     
    176175    }
    177176
    178     ExternalBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, llvm::Value * addr, unsigned AddressSpace = 0);
     177    ExternalBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & b, llvm::Type * type, llvm::Value * addr, unsigned AddressSpace = 0);
    179178
    180179    // Can't allocate - raise an error. */
    181     void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
     180    void allocateBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder) override;
    182181
    183182    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * fromPosition, llvm::Value *) const override;
     
    193192    }
    194193   
    195     CircularBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, unsigned AddressSpace = 0);
     194    CircularBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & b, llvm::Type * type, size_t bufferBlocks, unsigned AddressSpace = 0);
    196195
    197196protected:
     
    211210    static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::CircularCopybackBuffer;}
    212211   
    213     CircularCopybackBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned AddressSpace = 0);
    214 
    215     void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
     212    CircularCopybackBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & b, llvm::Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned AddressSpace = 0);
     213
     214    void allocateBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder) override;
    216215   
    217216    // Generate copyback code for the given number of overflowItems.
     
    233232    static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::SwizzledCopybackBuffer;}
    234233   
    235     SwizzledCopybackBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned fieldwidth = 64, unsigned AddressSpace = 0);
    236    
    237     void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
     234    SwizzledCopybackBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & b, llvm::Type * type, size_t bufferBlocks, size_t overflowBlocks, unsigned fieldwidth = 64, unsigned AddressSpace = 0);
     235   
     236    void allocateBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder) override;
    238237   
    239238    void createBlockAlignedCopy(IDISA::IDISA_Builder * const iBuilder, llvm::Value * targetBlockPtr, llvm::Value * sourceBlockPtr, llvm::Value * itemsToCopy) const override;
     
    244243    llvm::Value * getLinearlyWritableItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const override;
    245244   
    246     llvm::Value * getLinearlyWritableBlocks(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromBlock) const override;
     245    llvm::Value * getLinearlyWritableBlocks(IDISA::IDISA_Builder * constiBuilder, llvm::Value * self, llvm::Value * fromBlock) const override;
    247246   
    248247protected:
     
    261260    static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::ExpandableBuffer;}
    262261
    263     ExpandableBuffer(IDISA::IDISA_Builder * b, llvm::Type * type, size_t bufferBlocks, unsigned AddressSpace = 0);
     262    ExpandableBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & b, llvm::Type * type, size_t bufferBlocks, unsigned AddressSpace = 0);
    264263
    265264    llvm::Value * getStreamBlockPtr(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * streamIndex, llvm::Value * blockIndex, const bool readOnly) const override;
     
    269268    llvm::Value * getLinearlyAccessibleItems(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self, llvm::Value * fromPosition) const override;
    270269
    271     void allocateBuffer(IDISA::IDISA_Builder * const iBuilder) override;
     270    void allocateBuffer(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder) override;
    272271
    273272    llvm::Value * getStreamSetCount(IDISA::IDISA_Builder * const iBuilder, llvm::Value * self) const override;
Note: See TracChangeset for help on using the changeset viewer.