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

Initial introduction of a PabloFunction? type.

Location:
icGREP/icgrep-devel/icgrep/cc
Files:
2 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
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.h

    r4622 r4657  
    1313#include <string>
    1414
     15
     16namespace pablo {
     17    class PabloFunction;
     18}
     19
    1520namespace cc {
    1621
     
    2227    using Vars = std::vector<pablo::Var *>;
    2328
    24     CC_Compiler(pablo::PabloBlock & entry, const Encoding & encoding, const std::string basis_pattern = "basis");
    25 
    26     const Vars & getBasisBits(const CC_NameMap & nameMap) const;
     29    CC_Compiler(pablo::PabloFunction & function, const Encoding & encoding, const std::string prefix = "basis");
    2730
    2831    pablo::Assign * compileCC(const re::CC *cc);
     
    7477}
    7578
    76 inline const CC_Compiler::Vars & CC_Compiler::getBasisBits(const CC_NameMap &) const {
    77     return mBasisBit;
    78 }
    79 
    8079inline pablo::PabloBuilder & CC_Compiler::getBuilder() {
    8180    return mBuilder;
Note: See TracChangeset for help on using the changeset viewer.