Ignore:
Timestamp:
Feb 4, 2017, 9:28:54 AM (2 years ago)
Author:
cameron
Message:

getScalarOutput for Pablo kernels; use in wc

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

Legend:

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

    r5299 r5300  
    4242
    4343
     44Var * PabloKernel::getScalarOutput(std::string outputName) {
     45    const auto f = mScalarOutputNameMap.find(outputName);
     46    if (LLVM_UNLIKELY(f == mScalarOutputNameMap.end())) {
     47        llvm::report_fatal_error("Kernel does not contain scalar: " + outputName);
     48    }
     49    return f->second;
     50}
     51
     52
     53
    4454Var * PabloKernel::addInput(const std::string & name, Type * const type) {
    4555    Var * param = new (mAllocator) Var(mSymbolTable->makeString(name, iBuilder), type, mAllocator, Var::ReadOnly);
     
    6575    } else {
    6676        mScalarOutputs.emplace_back(type, name);
     77        mScalarOutputNameMap.emplace(name, result);
    6778    }
    6879    assert (mStreamSetOutputs.size() + mScalarOutputs.size() == mOutputs.size());
     
    161172        mOutputs.push_back(result);
    162173        mVariables.push_back(result);
     174        mScalarOutputNameMap.emplace(ss.name, result);
    163175    }
    164176}
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.h

    r5299 r5300  
    1212#include <util/slab_allocator.h>
    1313#include <llvm/ADT/StringRef.h>
     14#include <boost/container/flat_map.hpp>      // for mScalarOutputNameMap
    1415
    1516namespace IDISA { class IDISA_Builder; }
     
    8586   
    8687    Var * getOutputSet(std::string inputSetName);
     88   
     89    Var * getScalarOutput(std::string outputName);
    8790
    8891    Var * getOutput(const unsigned index) {
     
    151154    std::vector<PabloAST *>         mConstants;
    152155    std::vector<Var *>              mVariables;
    153 
     156    boost::container::flat_map<std::string, Var *> mScalarOutputNameMap;
    154157};
    155158
Note: See TracChangeset for help on using the changeset viewer.