Ignore:
Timestamp:
Jul 10, 2015, 4:51:39 PM (4 years ago)
Author:
nmedfort
Message:

Initial introduction of a PabloFunction? type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r4617 r4657  
    2020#include <pablo/codegenstate.h>
    2121#include <pablo/builder.hpp>
     22#include <pablo/function.h>
    2223#include <stdexcept>
    2324
     
    2728namespace cc {
    2829
    29 CC_Compiler::CC_Compiler(PabloBlock & entry, const Encoding & encoding, const std::string basis_pattern)
    30 : mBuilder(entry)
     30CC_Compiler::CC_Compiler(PabloFunction & function, const Encoding & encoding, const std::string prefix)
     31: mBuilder(function.getEntryBlock())
    3132, mBasisBit(encoding.getBits())
    32 , mEncoding(encoding)
    33 {
    34     for (int i = 0; i < mEncoding.getBits(); i++) {
    35         mBasisBit[i] = mBuilder.createVar(basis_pattern + std::to_string(i));
     33, mEncoding(encoding) {
     34    for (unsigned i = 0; i != encoding.getBits(); i++) {
     35        Var * var = mBuilder.createVar(prefix + std::to_string(i));
     36        function.addParameter(var);
     37        mBasisBit[encoding.getBits() - i - 1] = var;
    3638    }
    3739}
     
    267269
    268270inline Var * CC_Compiler::getBasisVar(const int i) const {
    269     return mBasisBit[(mEncoding.getBits() - 1) - i];
     271    return mBasisBit[i];
    270272}
    271273
Note: See TracChangeset for help on using the changeset viewer.