Ignore:
Timestamp:
May 12, 2017, 4:54:11 PM (2 years ago)
Author:
nmedfort
Message:

Refactoring work + correction for getRawItemPointer

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r5440 r5446  
    2424#include <pablo/ps_assign.h>
    2525#include <pablo/pablo_kernel.h>
    26 #include <kernels/kernel_builder.h>
     26#include <IR_Gen/idisa_builder.h>
     27#include <llvm/IR/Module.h>
    2728#include <llvm/Support/raw_os_ostream.h>
    2829
     
    4445
    4546Count * PabloBlock::createCount(PabloAST * expr) {
    46     Type * type = getParent()->getBuilder()->getSizeTy();
     47    IntegerType * const type = getParent()->getSizeTy();
    4748    return insertAtInsertionPoint(new (mAllocator) Count(expr, makeName("count"), type, mAllocator));
    4849}
    4950
    5051Count * PabloBlock::createCount(PabloAST * const expr, const llvm::StringRef & prefix)  {
    51     Type * type = getParent()->getBuilder()->getSizeTy();
     52    IntegerType * const type = getParent()->getSizeTy();
    5253    return insertAtInsertionPoint(new (mAllocator) Count(expr, makeName(prefix), type, mAllocator));
    5354}
     
    6364Var * PabloBlock::createVar(PabloAST * name, Type * type) {
    6465    if (type == nullptr) {
    65         type = getParent()->getBuilder()->getStreamTy();
     66        type = getParent()->getStreamTy();
    6667    }
    6768    if (LLVM_UNLIKELY(name == nullptr || !isa<String>(name))) {
     
    186187LessThan * PabloBlock::createLessThan(PabloAST * expr1, PabloAST * expr2) {
    187188    CHECK_SAME_TYPE(expr1, expr2);
    188     Type * type = getParent()->getBuilder()->getInt1Ty();
    189     return new (mAllocator) LessThan(type, expr1, expr2, mAllocator);
     189    IntegerType * const int1Ty = getParent()->getInt1Ty();
     190    return new (mAllocator) LessThan(int1Ty, expr1, expr2, mAllocator);
    190191}
    191192
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5440 r5446  
    9393
    9494Zeroes * PabloKernel::getNullValue(Type * type) {
    95     if (type == nullptr) {
    96         type = mBuilder->getStreamTy();
     95    if (LLVM_LIKELY(type == nullptr)) {
     96        type = getStreamTy();
    9797    }
    9898    for (PabloAST * constant : mConstants) {
     
    107107
    108108Ones * PabloKernel::getAllOnesValue(Type * type) {
    109     if (type == nullptr) {
    110         type = mBuilder->getStreamTy();
     109    if (LLVM_LIKELY(type == nullptr)) {
     110        type = getStreamTy();
    111111    }
    112112    for (PabloAST * constant : mConstants) {
     
    124124        setName(getName() + "_DumpTrace");
    125125    }
    126     mBuilder = iBuilder.get();
    127     generatePabloMethod();
    128     mBuilder = nullptr;
     126    mSizeTy = iBuilder->getSizeTy();
     127    mStreamTy = iBuilder->getStreamTy();
     128    generatePabloMethod();   
    129129    pablo_function_passes(this);
    130130    mPabloCompiler->initializeKernelData(iBuilder);
     131    mSizeTy = nullptr;
     132    mStreamTy = nullptr;
    131133    BlockOrientedKernel::prepareKernel(iBuilder);
    132134}
    133135
    134136void PabloKernel::generateDoBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder) {
    135     mBuilder = iBuilder.get();
     137    mSizeTy = iBuilder->getSizeTy();
     138    mStreamTy = iBuilder->getStreamTy();
    136139    mPabloCompiler->compile(iBuilder);
    137     mBuilder = nullptr;
     140    mSizeTy = nullptr;
     141    mStreamTy = nullptr;
    138142}
    139143
     
    152156Integer * PabloKernel::getInteger(const int64_t value) const {
    153157    return mSymbolTable->getInteger(value);
     158}
     159
     160llvm::IntegerType * PabloKernel::getInt1Ty() const {
     161    return IntegerType::getInt1Ty(getModule()->getContext());
    154162}
    155163
     
    168176, mSymbolTable(new SymbolGenerator(b->getContext(), mAllocator))
    169177, mEntryBlock(PabloBlock::Create(this))
    170 , mBuilder(nullptr)
    171 //, mSizeTy(b->getSizeTy())
    172 //, mSizeTy(b->getSizeTy())
    173 {
     178, mSizeTy(nullptr)
     179, mStreamTy(nullptr) {
    174180    prepareStreamSetNameMap();
    175181    for (const Binding & ss : mStreamSetInputs) {
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.h

    r5440 r5446  
    123123    Integer * getInteger(const int64_t value) const;
    124124
    125     kernel::KernelBuilder * getBuilder() {
    126         return mBuilder;
    127     }
    128 
    129125protected:
    130126
     
    136132
    137133    virtual void generatePabloMethod() = 0;
     134
     135    llvm::IntegerType * getSizeTy() const {
     136        assert (mSizeTy); return mSizeTy;
     137    }
     138
     139    llvm::VectorType * getStreamTy() const {
     140        assert (mStreamTy); return mStreamTy;
     141    }
     142
     143    llvm::IntegerType * getInt1Ty() const;
    138144
    139145private:
     
    157163    SymbolGenerator *               mSymbolTable;
    158164    PabloBlock *                    mEntryBlock;
    159 
    160     kernel::KernelBuilder *         mBuilder;
    161 
    162 //    llvm::IntegerType * const       mSizeTy;
    163 //    llvm::VectorType * const        mStreamSetTy;
    164 
     165    llvm::IntegerType *             mSizeTy;
     166    llvm::VectorType *              mStreamTy;
    165167    std::vector<Var *>              mInputs;
    166168    std::vector<Var *>              mOutputs;
Note: See TracChangeset for help on using the changeset viewer.