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

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

Location:
icGREP/icgrep-devel/icgrep/IDISA/types
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IDISA/types/streamtype.cpp

    r5216 r5217  
    1 #include <pablo/type/streamtype.h>
     1#include "streamtype.h"
    22#include <boost/container/flat_map.hpp>
    33#include <IDISA/idisa_builder.h>
     
    66using namespace llvm;
    77
    8 namespace pablo {
     8namespace IDISA {
    99
    10 static flat_map<uint64_t, StreamType *> STREAM_TYPES;
     10static flat_map<std::pair<unsigned, unsigned>, StreamType *> STREAM_TYPES;
    1111
    12 StreamType * StreamType::get(llvm::LLVMContext & ctx, const uint64_t FieldWidth) {
    13     const auto f = STREAM_TYPES.find(FieldWidth);
     12StreamType * StreamType::get(llvm::LLVMContext & ctx, unsigned NumElements, unsigned FieldWidth) {
     13    const auto f = STREAM_TYPES.find(std::make_pair(NumElements, FieldWidth));
    1414    if (LLVM_LIKELY(f != STREAM_TYPES.end())) {
    1515        return f->second;
    1616    } else {
    17         StreamType * const T = new StreamType(ctx, FieldWidth);
    18         STREAM_TYPES.emplace(FieldWidth, T);
     17        StreamType * const T = new StreamType(ctx, NumElements, FieldWidth);
     18        STREAM_TYPES.emplace(std::make_pair(NumElements, FieldWidth), T);
    1919        return T;
    2020    }
     
    2222
    2323llvm::Type * StreamType::resolveType(IDISA::IDISA_Builder * const iBuilder) {
    24     return mFieldWidth == 1 ? iBuilder->getBitBlockType() : ArrayType::get(iBuilder->getBitBlockType(), mFieldWidth);
     24    return ArrayType::get(iBuilder->getBitBlockType(), mNumElements);
    2525}
    2626
    27 StreamType::StreamType(llvm::LLVMContext & C, uint64_t FieldWidth)
     27StreamType::StreamType(llvm::LLVMContext & C, unsigned NumElements, unsigned FieldWidth)
    2828: llvm::Type(C, (Type::TypeID)(StreamTyId))
     29, mNumElements(NumElements)
    2930, mFieldWidth(FieldWidth) {
    3031
Note: See TracChangeset for help on using the changeset viewer.