Ignore:
Timestamp:
Jan 19, 2017, 2:41:02 PM (3 years ago)
Author:
nmedfort
Message:

Code clean-up. Removed Pablo Call, SetIthBit? and Prototype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/p2s_kernel.cpp

    r5261 r5267  
    11#include "p2s_kernel.h"
    2 #include "kernels/kernel.h"
    3 #include "IR_Gen/idisa_builder.h"
    4 #include <llvm/IR/Type.h>
     2#include "IR_Gen/idisa_builder.h"  // for IDISA_Builder
     3#include "llvm/IR/Constant.h"      // for Constant
     4#include "llvm/IR/Constants.h"     // for ConstantInt
     5#include "llvm/IR/DerivedTypes.h"  // for PointerType, VectorType
     6#include "llvm/IR/Function.h"      // for Function, Function::arg_iterator
    57#include <llvm/IR/Module.h>
    6 #include <iostream>
    7 #include <stdint.h>
    8 #include <llvm/Support/FileSystem.h>
    9 #include <llvm/Support/raw_ostream.h>
     8#include <kernels/streamset.h>
     9namespace llvm { class Value; }
    1010
    1111using namespace llvm;
     
    116116}
    117117   
    118 P2SKernelWithCompressedOutput::P2SKernelWithCompressedOutput(IDISA::IDISA_Builder * iBuilder) :
    119     KernelBuilder(iBuilder, "p2s_compress",
    120                   {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}, Binding{iBuilder->getStreamSetTy(1, 1), "deletionCounts"}},
    121                   {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
    122                   {}, {}, {}) {
    123         setDoBlockUpdatesProducedItemCountsAttribute(true);
    124 
    125     }
     118P2SKernelWithCompressedOutput::P2SKernelWithCompressedOutput(IDISA::IDISA_Builder * iBuilder)
     119: KernelBuilder(iBuilder, "p2s_compress",
     120              {Binding{iBuilder->getStreamSetTy(8, 1), "basisBits"}, Binding{iBuilder->getStreamSetTy(1, 1), "deletionCounts"}},
     121              {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"}},
     122              {}, {}, {}) {
     123    setDoBlockUpdatesProducedItemCountsAttribute(true);
     124}
    126125   
    127126   
     
    178177    auto savePoint = iBuilder->saveIP();
    179178    Module * m = iBuilder->getModule();
    180     Type * i32 = iBuilder->getIntNTy(32);
    181     Type * bitBlockPtrTy = llvm::PointerType::get(iBuilder->getBitBlockType(), 0);
     179    Type * i32Ty = iBuilder->getInt32Ty();
     180    Type * bitBlockPtrTy = iBuilder->getBitBlockType()->getPointerTo();
    182181
    183182    Function * doBlockFunction = m->getFunction(mKernelName + doBlock_suffix);
     
    212211    Value * i16BlockNo = iBuilder->CreateUDiv(i16UnitsGenerated, stride);
    213212    Value * u16_output_ptr = getStreamView(int16PtrTy, self, "i16Stream", i16BlockNo, iBuilder->CreateURem(i16UnitsGenerated, stride));
    214     Value * offset = ConstantInt::get(i32, 0);
     213    Value * offset = ConstantInt::get(i32Ty, 0);
    215214    for (unsigned j = 0; j < 8; ++j) {
    216215        Value * merge0 = iBuilder->bitCast(iBuilder->esimd_mergel(8, hi_bytes[j], lo_bytes[j]));
    217216        Value * merge1 = iBuilder->bitCast(iBuilder->esimd_mergeh(8, hi_bytes[j], lo_bytes[j]));
    218217        iBuilder->CreateAlignedStore(merge0, iBuilder->CreateBitCast(iBuilder->CreateGEP(u16_output_ptr, offset), bitBlockPtrTy), 1);
    219         offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2 * j)), i32);
     218        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2 * j)), i32Ty);
    220219        iBuilder->CreateAlignedStore(merge1, iBuilder->CreateBitCast(iBuilder->CreateGEP(u16_output_ptr, offset), bitBlockPtrTy), 1);
    221         offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2 * j + 1)), i32);
     220        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(2 * j + 1)), i32Ty);
    222221    }
    223222    i16UnitsGenerated = iBuilder->CreateAdd(i16UnitsGenerated, iBuilder->CreateZExt(offset, iBuilder->getSizeTy()));
Note: See TracChangeset for help on using the changeset viewer.