Ignore:
Timestamp:
Jan 5, 2017, 3:54:40 PM (2 years ago)
Author:
nmedfort
Message:

Code clean up to enforce proper calling order of KernelBuilder? methods

File:
1 edited

Legend:

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

    r5245 r5246  
    1616    llvm::Type * type;
    1717    std::string name;
    18 
    19     Binding(llvm::Type * type, std::string name)
    20     : type(type)
    21     , name(std::move(name)) {
    22 
    23     }
     18    Binding(llvm::Type * type, const std::string & name) : type(type), name(name) {}
     19    Binding(llvm::Type * type, std::string && name) : type(type), name(name) {}
    2420};
    2521
     
    4137     
    4238     */
    43    
    44     std::string & getName() { return mKernelName;}
    45    
     39       
    4640    std::vector<Binding> getStreamInputs() {return mStreamSetInputs;}
    4741    std::vector<Binding> getStreamOutputs() {return mStreamSetOutputs;}
     
    5246    // Add ExternalLinkage method declarations for the kernel to a given client module.
    5347    void addKernelDeclarations(Module * client);
    54    
    55     void setInitialArguments(std::vector<llvm::Value *> initialParameters);
    56     virtual void createInstance();
    57     llvm::Value * getInstance() {return mKernelInstance;};
     48    virtual void createInstance() = 0;
     49    void setInitialArguments(std::vector<Value *> initialParameters);
     50    llvm::Value * getInstance() const { return mKernelInstance; }
    5851
    59     llvm::Value * createDoSegmentCall(llvm::Value * kernelInstance, llvm::Value * blkCount);
    60     llvm::Value * createFinalBlockCall(llvm::Value * kernelInstance, llvm::Value * remainingBytes);
    61     llvm::Value * createGetAccumulatorCall(llvm::Value * kernelInstance, std::string accumName);
     52    llvm::Value * createDoSegmentCall(llvm::Value * self, llvm::Value * blkCount) const;
     53    llvm::Value * createFinalBlockCall(llvm::Value * self, llvm::Value * remainingBytes) const;
     54    llvm::Value * createGetAccumulatorCall(llvm::Value * self, std::string accumName) const;
    6255   
    6356    unsigned getLookAhead() const {
     
    6962    }
    7063
    71     virtual llvm::Value * getProcessedItemCount(llvm::Value * kernelInstance) = 0;
    72     virtual llvm::Value * getProducedItemCount(llvm::Value * kernelInstance) = 0;
    73     virtual llvm::Value * getTerminationSignal(llvm::Value * kernelInstance) = 0;
     64    virtual llvm::Value * getProcessedItemCount(llvm::Value * self) const = 0;
     65    virtual llvm::Value * getProducedItemCount(llvm::Value * self) const = 0;
     66    virtual llvm::Value * getTerminationSignal(llvm::Value * self) const = 0;
    7467   
    7568    void setLookAhead(unsigned lookAheadPositions) {
     
    7770    }
    7871
    79     llvm::Value * createDoBlockCall(llvm::Value * kernelInstance);
     72    llvm::Value * createDoBlockCall(llvm::Value * self) const;
    8073
    8174protected:
Note: See TracChangeset for help on using the changeset viewer.