Ignore:
Timestamp:
Feb 3, 2017, 2:31:24 PM (2 years ago)
Author:
nmedfort
Message:

Removed StreamType? in favour of 0-length VectorType?.

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 edited

Legend:

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

    r5297 r5298  
    77#include <toolchain.h>
    88#include <kernels/streamset.h>
    9 #include <IR_Gen/types/streamtype.h>
    109#include <llvm/IR/Constants.h>
    1110#include <llvm/IR/Function.h>
     
    3534using namespace kernel;
    3635using namespace parabix;
    37 
    38 using StreamType = IDISA::StreamType;
    3936
    4037unsigned KernelBuilder::addScalar(Type * const type, const std::string & name) {
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5297 r5298  
    66#include "streamset.h"
    77#include <IR_Gen/idisa_builder.h>  // for IDISA_Builder
    8 #include <IR_Gen/types/streamtype.h>
    98#include <assert.h>                // for assert
    109#include <llvm/IR/Type.h>          // for Type
     
    2322using namespace IDISA;
    2423
    25 Type * StreamSetBuffer::resolveStreamSetBufferType(Type * type) const {
    26     if (auto ty = dyn_cast<ArrayType>(type)) {
    27         unsigned numElems = ty->getNumElements();
    28         auto elemTy = ty->getElementType();
    29         if (isa<StreamType>(elemTy)) {
    30             return ArrayType::get(cast<StreamType>(elemTy)->resolveType(iBuilder), numElems);
     24Type * resolveVectorTy(IDISA_Builder * const b, Type * type) {
     25    if (LLVM_LIKELY(type->isVectorTy() && type->getVectorNumElements() == 0)) {
     26        type = type->getVectorElementType();
     27        if (LLVM_LIKELY(type->isIntegerTy())) {
     28            const auto fieldWidth = cast<IntegerType>(type)->getBitWidth();
     29            type = b->getBitBlockType();
     30            if (fieldWidth != 1) {
     31                type = llvm::ArrayType::get(type, fieldWidth);
     32            }
    3133        }
    3234    }
    33     else if (auto ty = dyn_cast<StreamType>(type)) {
    34         return ty->resolveType(iBuilder);
     35    return type;
     36}
     37
     38Type * StreamSetBuffer::resolveStreamSetBufferType(Type * const type) const {
     39    if (type->isArrayTy()) {
     40        return ArrayType::get(resolveVectorTy(iBuilder, type->getArrayElementType()), type->getArrayNumElements());
     41    } else if (type->isVectorTy()) {
     42        return resolveVectorTy(iBuilder, type);
    3543    }
    3644    return type;
Note: See TracChangeset for help on using the changeset viewer.