Ignore:
Timestamp:
Nov 18, 2016, 1:46:55 PM (2 years ago)
Author:
nmedfort
Message:

Merged PabloFunction? and PabloKernel? classes. Updated projects where necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h

    r5204 r5217  
    1414#include <llvm/Support/Host.h>
    1515#include <llvm/ADT/Triple.h>
     16#include <IDISA/types/streamtype.h>
    1617
    1718using namespace llvm;
     
    2223public:
    2324
    24     IDISA_Builder(Module * m, Type * bitBlockType, unsigned CacheAlignment=64)
     25    IDISA_Builder(Module * m, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride, unsigned CacheAlignment=64)
    2526    : IRBuilder<>(m->getContext())
    2627    , mMod(m)
    2728    , mCacheLineAlignment(CacheAlignment)
    28     , mIsArch32Bit(Triple(llvm::sys::getProcessTriple()).isArch32Bit())
    29     , mBitBlockType(bitBlockType)
    30     , mBitBlockWidth(bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth())
    31     , mStride(mBitBlockWidth)
    32     , mZeroInitializer(Constant::getNullValue(bitBlockType))
    33     , mOneInitializer(Constant::getAllOnesValue(bitBlockType))
     29    , mBitBlockWidth(bitBlockWidth)
     30    , mStride(stride)
     31    , mSizeType(getIntNTy(archBitWidth))
     32    , mBitBlockType(VectorType::get(IntegerType::get(getContext(), 64), bitBlockWidth / 64))
     33    , mZeroInitializer(Constant::getNullValue(mBitBlockType))
     34    , mOneInitializer(Constant::getAllOnesValue(mBitBlockType))
    3435    , mPrintRegisterFunction(nullptr) {
    3536
     
    3839    virtual ~IDISA_Builder() {}
    3940   
    40     Type * getBitBlockType() const {
    41         return mBitBlockType;
    42     }
    43 
    44     std::string getBitBlockTypeName();  // A short string such as v4i64 or i256.
     41    std::string getBitBlockTypeName() const;  // A short string such as v4i64 or i256.
    4542
    4643    Value * bitCast(Value * a) {
    47         return a->getType() == mBitBlockType ? a : CreateBitCast(a, mBitBlockType);
     44        return (a->getType() == mBitBlockType) ? a : CreateBitCast(a, mBitBlockType);
    4845    }
    4946
     
    142139    Value * fwCast(unsigned fw, Value * a);
    143140   
    144     inline bool isArch32Bit() const {
    145         return mIsArch32Bit;
    146     }
    147 
    148     inline llvm::IntegerType * getSizeTy() {
    149         return isArch32Bit() ? getInt32Ty() : getInt64Ty();
     141    inline llvm::IntegerType * getSizeTy() const {
     142        return mSizeType;
     143    }
     144
     145    inline VectorType * getBitBlockType() const {
     146        return mBitBlockType;
     147    }
     148
     149    inline Type * getStreamSetTy(const uint64_t NumElements = 1, const uint64_t FieldWidth = 1) {
     150        return StreamType::get(getContext(), NumElements, FieldWidth);
    150151    }
    151152   
     
    160161   
    161162protected:
    162     Module * mMod;
    163     unsigned mCacheLineAlignment;
    164     const bool mIsArch32Bit;
    165     Type * mBitBlockType;
    166     unsigned mBitBlockWidth;
    167     unsigned mStride;
    168     Constant * mZeroInitializer;
    169     Constant * mOneInitializer;
    170     Constant * mPrintRegisterFunction;
    171 
     163    Module *            mMod;
     164    unsigned            mCacheLineAlignment;
     165    unsigned            mBitBlockWidth;
     166    unsigned            mStride;
     167    IntegerType *       mSizeType;
     168    VectorType *        mBitBlockType;
     169
     170    Constant *          mZeroInitializer;
     171    Constant *          mOneInitializer;
     172    Constant *          mPrintRegisterFunction;
    172173   
    173174    VectorType * fwVectorType(unsigned fw);
Note: See TracChangeset for help on using the changeset viewer.