Ignore:
Timestamp:
Feb 25, 2017, 12:50:29 PM (2 years ago)
Author:
nmedfort
Message:

Added enable asserts (-ea) command line flag + restructured BlockOrientedKernels? to allow for inlined code.

File:
1 edited

Legend:

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

    r5329 r5347  
    1515namespace llvm { class ConstantInt; }
    1616namespace llvm { class Function; }
     17namespace llvm { namespace legacy { class FunctionPassManager; } }
    1718namespace llvm { class IntegerType; }
    1819namespace llvm { class LoadInst; }
     
    137138    virtual void generateDoSegmentMethod(llvm::Value * doFinal, const std::vector<llvm::Value *> & producerPos) = 0;
    138139
    139     virtual void generateInternalMethods() { }
     140//    virtual void generateInternalMethods() { }
    140141
    141142    // Add an additional scalar field to the KernelState struct.
     
    265266
    266267    llvm::Value *                                   mSelf;
    267     llvm::Function *                                mCurrentFunction;
     268    llvm::Function *                                mCurrentMethod;
    268269
    269270    std::vector<llvm::Type *>                       mKernelFields;
     
    293294
    294295class BlockOrientedKernel : public KernelBuilder {
    295 public:
    296 
    297     llvm::CallInst * CreateDoBlockMethodCall() const;
    298 
    299     llvm::CallInst * CreateDoFinalBlockMethodCall(llvm::Value * remainingItems) const;
    300 
    301296protected:
    302297
    303     virtual void addAdditionalKernelDeclarations(llvm::Module * module, llvm::PointerType * selfType);
     298    void CreateDoBlockMethodCall();
    304299
    305300    // Each kernel builder subtype must provide its own logic for generating
     
    314309    // not be overridden.
    315310
    316     virtual void generateFinalBlockMethod(llvm::Value * remainingBytes);
    317 
    318     virtual void generateDoSegmentMethod(llvm::Value * doFinal, const std::vector<llvm::Value *> & producerPos) final;
    319 
    320     void generateInternalMethods() override final;
     311    virtual void generateFinalBlockMethod(llvm::Value * remainingItems);
     312
     313    void generateDoSegmentMethod(llvm::Value * doFinal, const std::vector<llvm::Value *> & producerPos) override final;
    321314
    322315    BlockOrientedKernel(IDISA::IDISA_Builder * builder,
     
    330323    virtual ~BlockOrientedKernel() { }
    331324
    332     llvm::Value * loadBlock(const std::string & inputName, llvm::Value * const streamIndex) const;
    333 
    334     llvm::Value * loadPack(const std::string & inputName, llvm::Value * const streamIndex, llvm::Value * const packIndex) const;
    335 
    336     llvm::Function * getDoBlockFunction() const;
    337 
    338     llvm::Function * getDoFinalBlockFunction() const;
     325    bool isCalled() const {
     326        return !mInlined;
     327    }
     328
     329    bool isInlined() const {
     330        return mInlined;
     331    }
     332
     333    void setInlined(const bool value = true) {
     334        mInlined = value;
     335    }
    339336
    340337private:
    341338
    342     void callGenerateDoBlockMethod();
    343 
    344     void callGenerateDoFinalBlockMethod();
    345 
     339    void generateDoBlockMethod(llvm::legacy::FunctionPassManager & fpm);
     340
     341    void writeDoBlockMethod();
     342
     343    void generateFinalBlockMethod(llvm::Value *remainingItems, llvm::legacy::FunctionPassManager & fpm);
     344
     345private:
     346
     347    llvm::Function * mDoBlockMethod;
     348    bool             mInlined;
    346349};
    347350
Note: See TracChangeset for help on using the changeset viewer.