Ignore:
Timestamp:
May 7, 2017, 4:34:48 PM (2 years ago)
Author:
nmedfort
Message:

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

File:
1 edited

Legend:

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

    r5435 r5436  
    2222namespace kernel {
    2323   
     24class KernelBuilder;
     25
    2426class Kernel : public KernelInterface {
    2527protected:
     
    3234
    3335    friend class KernelBuilder;
    34     friend void ::generateSegmentParallelPipeline(IDISA::IDISA_Builder * const, const Kernels &);
    35     friend void ::generatePipelineLoop(IDISA::IDISA_Builder * const, const Kernels &);
    36     friend void ::generateParallelPipeline(IDISA::IDISA_Builder * const, const Kernels &);
     36    friend void ::generateSegmentParallelPipeline(const std::unique_ptr<kernel::KernelBuilder> &, const Kernels &);
     37    friend void ::generatePipelineLoop(const std::unique_ptr<kernel::KernelBuilder> &, const Kernels &);
     38    friend void ::generateParallelPipeline(const std::unique_ptr<kernel::KernelBuilder> &, const Kernels &);
    3739
    3840    static const std::string DO_BLOCK_SUFFIX;
     
    117119    void setTerminationSignal() const final;
    118120
    119     bool hasNoTerminateAttribute() const {
    120         return mNoTerminateAttribute;
    121     }
    122 
    123121    // Get the value of a scalar field for the current instance.
    124     llvm::Value * getScalarFieldPtr(llvm::Value * index) const {
    125         return iBuilder->CreateGEP(getInstance(), {iBuilder->getInt32(0), index});
    126     }
    127 
    128     llvm::Value * getScalarFieldPtr(const std::string & fieldName) const {
    129         return getScalarFieldPtr(iBuilder->getInt32(getScalarIndex(fieldName)));
    130     }
    131 
    132     llvm::Value * getScalarField(const std::string & fieldName) const {
    133         return iBuilder->CreateLoad(getScalarFieldPtr(fieldName), fieldName);
    134     }
     122    llvm::Value * getScalarFieldPtr(llvm::Value * index) const;
     123
     124    llvm::Value * getScalarFieldPtr(const std::string & fieldName) const;
     125
     126    llvm::Value * getScalarField(const std::string & fieldName) const;
    135127
    136128    // Set the value of a scalar field for the current instance.
    137     void setScalarField(const std::string & fieldName, llvm::Value * value) const {
    138         iBuilder->CreateStore(value, getScalarFieldPtr(fieldName));
    139     }
     129    void setScalarField(const std::string & fieldName, llvm::Value * value) const;
    140130
    141131    // Synchronization actions for executing a kernel for a particular logical segment.
     
    152142    void releaseLogicalSegmentNo(llvm::Value * nextSegNo) const;
    153143
    154     // Get a parameter by name.
    155     llvm::Argument * getParameter(llvm::Function * f, const std::string & name) const;
     144    bool hasNoTerminateAttribute() const {
     145        return mNoTerminateAttribute;
     146    }
    156147
    157148    const StreamSetBuffers & getStreamSetInputBuffers() const {
     
    378369private:
    379370
    380     virtual bool useIndirectBr() const {
    381         return iBuilder->supportsIndirectBr();
    382     }
     371    virtual bool useIndirectBr() const;
    383372
    384373    void writeDoBlockMethod();
Note: See TracChangeset for help on using the changeset viewer.