Ignore:
Timestamp:
Feb 26, 2017, 4:30:51 PM (2 years ago)
Author:
nmedfort
Message:

First attempt at inlining all DoBlock? and FinalBlock? functions by using indirect jumps. Disabled for NVPTX until Linda can check whether they're supported by the LLVM NVPTX library.

File:
1 edited

Legend:

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

    r5347 r5350  
    1212#include <boost/container/flat_map.hpp>
    1313#include <IR_Gen/idisa_builder.h>
    14 #include "llvm/Support/Debug.h"
     14
    1515namespace llvm { class ConstantInt; }
    1616namespace llvm { class Function; }
    17 namespace llvm { namespace legacy { class FunctionPassManager; } }
    1817namespace llvm { class IntegerType; }
    1918namespace llvm { class LoadInst; }
     
    138137    virtual void generateDoSegmentMethod(llvm::Value * doFinal, const std::vector<llvm::Value *> & producerPos) = 0;
    139138
    140 //    virtual void generateInternalMethods() { }
    141 
    142139    // Add an additional scalar field to the KernelState struct.
    143140    // Must occur before any call to addKernelDeclarations or createKernelModule.
     
    323320    virtual ~BlockOrientedKernel() { }
    324321
    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     }
    336 
    337322private:
    338323
    339     void generateDoBlockMethod(llvm::legacy::FunctionPassManager & fpm);
     324    bool useIndirectBr() const {
     325        return iBuilder->supportsIndirectBr();
     326    }
    340327
    341328    void writeDoBlockMethod();
    342329
    343     void generateFinalBlockMethod(llvm::Value *remainingItems, llvm::legacy::FunctionPassManager & fpm);
     330    void writeFinalBlockMethod(llvm::Value * remainingItems);
    344331
    345332private:
    346333
    347     llvm::Function * mDoBlockMethod;
    348     bool             mInlined;
     334    llvm::Function *        mDoBlockMethod;
     335    llvm::BasicBlock *      mStrideLoopBody;
     336    llvm::IndirectBrInst *  mStrideLoopBranch;
     337    llvm::PHINode *         mStrideLoopBranchAddress;
    349338};
    350339
Note: See TracChangeset for help on using the changeset viewer.