Changeset 5298


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

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

Location:
icGREP/icgrep-devel/icgrep
Files:
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r5289 r5298  
    5050SET(KERNEL_SRC kernels/kernel.cpp kernels/pipeline.cpp kernels/s2p_kernel.cpp kernels/streamset.cpp kernels/interface.cpp kernels/mmap_kernel.cpp)
    5151
    52 SET(IDISA_SRC IR_Gen/CBuilder.cpp IR_Gen/types/streamtype.cpp IR_Gen/idisa_builder.cpp IR_Gen/idisa_avx_builder.cpp IR_Gen/idisa_i64_builder.cpp IR_Gen/idisa_sse_builder.cpp IR_Gen/idisa_nvptx_builder.cpp IR_Gen/idisa_target.cpp)
     52SET(IDISA_SRC IR_Gen/CBuilder.cpp IR_Gen/idisa_builder.cpp IR_Gen/idisa_avx_builder.cpp IR_Gen/idisa_i64_builder.cpp IR_Gen/idisa_sse_builder.cpp IR_Gen/idisa_nvptx_builder.cpp IR_Gen/idisa_target.cpp)
    5353
    5454SET(PABLO_SRC pablo/pabloAST.cpp pablo/branch.cpp pablo/codegenstate.cpp pablo/builder.cpp pablo/symbol_generator.cpp pablo/printer_pablos.cpp pablo/pablo_toolchain.cpp)
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.cpp

    r5267 r5298  
    380380}
    381381
    382 StreamType * IDISA_Builder::getStreamTy(const unsigned FieldWidth) {
    383     const auto f = mStreamTypes.find(FieldWidth);
    384     if (LLVM_LIKELY(f != mStreamTypes.end())) {
    385         return f->second;
    386     } else {
    387         StreamType * const T = new StreamType(getContext(), FieldWidth);
    388         mStreamTypes.emplace(FieldWidth, T);
    389         return T;
    390     }
    391 }
    392 
    393382IDISA_Builder::IDISA_Builder(Module * m, unsigned archBitWidth, unsigned bitBlockWidth, unsigned stride, unsigned CacheAlignment)
    394383: CBuilder(m, archBitWidth, CacheAlignment)
     
    403392
    404393IDISA_Builder::~IDISA_Builder() {
    405     for (const auto t : mStreamTypes) {
    406         delete std::get<1>(t);
    407     }
    408     mStreamTypes.clear();
    409 }
    410 
    411 }
     394
     395}
     396
     397}
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.h

    r5260 r5298  
    99#include "CBuilder.h"
    1010#include <llvm/IR/DerivedTypes.h>
    11 #include <IR_Gen/types/streamtype.h>
    12 #include <boost/container/flat_map.hpp>
    1311namespace llvm { class Constant; }
    1412namespace llvm { class LoadInst; }
    1513namespace llvm { class Module; }
    16 namespace llvm { class Type; }
    1714namespace llvm { class Value; }
    1815
     
    2017
    2118class IDISA_Builder : public CBuilder {
    22 
    23     using StreamTypes = boost::container::flat_map<unsigned, StreamType *>;
    2419
    2520public:
     
    128123    }
    129124   
    130     StreamType * getStreamTy(const unsigned FieldWidth = 1);
     125    llvm::VectorType * getStreamTy(const unsigned FieldWidth = 1) {
     126        return llvm::VectorType::get(llvm::IntegerType::getIntNTy(getContext(), FieldWidth), 0);
     127    }
    131128
    132129    void CallPrintRegister(const std::string & regName, llvm::Value * const value);
     
    136133    unsigned            mStride;
    137134    llvm::VectorType *  mBitBlockType;
    138 
    139135    llvm::Constant *    mZeroInitializer;
    140136    llvm::Constant *    mOneInitializer;
    141137    llvm::Constant *    mPrintRegisterFunction;
    142     StreamTypes         mStreamTypes;
    143138};
    144139
  • icGREP/icgrep-devel/icgrep/icgrep-devel.files

    r5297 r5298  
    1313editd/pattern_compiler.cpp
    1414editd/pattern_compiler.h
    15 IR_Gen/types/streamtype.cpp
    16 IR_Gen/types/streamtype.h
    1715IR_Gen/CBuilder.cpp
    1816IR_Gen/CBuilder.h
  • 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;
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r5283 r5298  
    2929    assert ("DIFFERING TYPES" && ((A)->getType() == (B)->getType()))
    3030
    31 using StreamType = IDISA::StreamType;
    3231using namespace llvm;
    33 
    34 inline void printType(const Type * type, raw_string_ostream & out) {
    35     if (auto st = dyn_cast<StreamType>(type)) {
    36         out << "s" << st->getFieldWidth();
    37         return;
    38     }
    39     if (auto ty = dyn_cast<ArrayType>(type)) {
    40         unsigned numElems = ty->getNumElements();
    41         auto elemTy = ty->getElementType();
    42         if (auto st = dyn_cast<StreamType>(elemTy)) {
    43             out << "<" << numElems << " x s" << st->getFieldWidth() << ">";
    44             return;
    45         }
    46     }
    47     type->print(out);
    48 }
    4932
    5033namespace pablo {
     
    216199        case AssignErrorType::TypeMismatch:
    217200            out << "type mismatch ";
    218             printType(value->getType(), out);
     201            value->getType()->print(out);
    219202            out << " vs. ";
    220             printType(var->getType(), out);
     203            var->getType()->print(out);
    221204            break;
    222205        case AssignErrorType::ReadOnlyVar:
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5297 r5298  
    2020using namespace llvm;
    2121
     22inline bool isStreamType(const Type * ty) {
     23    if (ty->isArrayTy()) {
     24        ty = ty->getArrayElementType();
     25    }
     26    if (ty->isVectorTy()) {
     27        return (ty->getVectorNumElements() == 0);
     28    }
     29    return false;
     30}
     31
    2232Var * PabloKernel::addInput(const std::string & name, Type * const type) {
    2333    Var * param = new (mAllocator) Var(mSymbolTable->makeString(name, iBuilder), type, mAllocator, Var::ReadOnly);
     
    2535    mInputs.push_back(param);
    2636    mVariables.push_back(param);
    27     if (isa<ArrayType>(type) || isa<StreamType>(type)) {
     37    if (isStreamType(type)) {
    2838        mStreamSetInputs.emplace_back(type, name);
    2939    } else {
     
    3949    mOutputs.push_back(result);
    4050    mVariables.push_back(result);
    41     if (isa<ArrayType>(type) || isa<StreamType>(type)) {
     51    if (isStreamType(type)) {
    4252        mStreamSetOutputs.emplace_back(type, name);
    4353    } else {
Note: See TracChangeset for help on using the changeset viewer.