Ignore:
Timestamp:
Oct 18, 2014, 5:43:45 PM (5 years ago)
Author:
nmedfort
Message:

Big update to use CC_NameMap; removed CharClass? and RE_Reducer.

File:
1 edited

Legend:

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

    r4247 r4249  
    1414#include <pablo/codegenstate.h>
    1515#include <pablo/printer_pablos.h>
     16#include <cc/cc_namemap.hpp>
     17#include <re/re_name.h>
    1618#include <stdexcept>
    1719#include <include/simd-lib/bitblock.hpp>
    1820
    19 // #define DUMP_GENERATED_IR
    20 // #define DUMP_OPTIMIZED_IR
     21//#define DUMP_GENERATED_IR
     22//#define DUMP_OPTIMIZED_IR
    2123
    2224extern "C" {
     
    7274namespace pablo {
    7375
    74 PabloCompiler::PabloCompiler(std::map<std::string, std::string> name_map, const BasisBitVars & basisBitVars, int bits)
     76PabloCompiler::PabloCompiler(const cc::CC_NameMap & nameMap, const BasisBitVars & basisBitVars, int bits)
    7577: mBits(bits)
    76 , m_name_map(name_map)
    7778, mBasisBitVars(basisBitVars)
    7879, mMod(new Module("icgrep", getGlobalContext()))
     
    9394, mPtr_carry_q_addr(nullptr)
    9495, mPtr_output_addr(nullptr)
     96, mNameMap(nameMap)
    9597{
    9698    //Create the jit execution engine.up
     
    178180    //Generate the IR instructions for the function.
    179181    SetReturnMarker(compileStatements(cg_state.expressions()), 0); // matches
    180     SetReturnMarker(GetMarker(m_name_map.find("LineFeed")->second), 1); // line feeds
     182    SetReturnMarker(GetMarker(mNameMap["LineFeed"]->getName()), 1); // line feeds
    181183
    182184    assert (mCarryQueueIdx == mCarryQueueSize);
     
    681683        retVal = b.CreateXor(expr_value, mAllOneInitializer, "not");
    682684    }
    683     else if (const CharClass * cc = dyn_cast<CharClass>(expr))
    684     {
    685         retVal = b.CreateLoad(GetMarker(cc->getCharClass()));
    686     }
    687685    else if (const Advance * adv = dyn_cast<Advance>(expr))
    688686    {
     
    701699        Value* marker_expr = compileExpression(sthru->getScanFrom());
    702700        Value* cc_expr = compileExpression(sthru->getScanThru());
    703         retVal = b.CreateAnd(genAddWithCarry(marker_expr, cc_expr), genNot(cc_expr), "scanthru_rslt");
     701        retVal = b.CreateAnd(genAddWithCarry(marker_expr, cc_expr), genNot(cc_expr), "scanthru");
    704702    }
    705703    return retVal;
     
    820818    Constant* const_packed_1_elems [] = {b.getInt32(0), b.getInt32(2)};
    821819    Constant* const_packed_1 = ConstantVector::get(const_packed_1_elems);
    822     packed_shuffle = b.CreateShuffleVector(carryq_value, srli_1_value, const_packed_1, "packed_shuffle nw");
     820    packed_shuffle = b.CreateShuffleVector(carryq_value, srli_1_value, const_packed_1);
    823821
    824822    Constant* const_packed_2_elems[] = {b.getInt64(1), b.getInt64(1)};
    825823    Constant* const_packed_2 = ConstantVector::get(const_packed_2_elems);
    826824
    827     Value* shl_value = b.CreateShl(strm_value, const_packed_2, "shl_value");
    828     Value* result_value = b.CreateOr(shl_value, packed_shuffle, "or.result_value");
     825    Value* shl_value = b.CreateShl(strm_value, const_packed_2);
     826    Value* result_value = b.CreateOr(shl_value, packed_shuffle, "advance");
    829827
    830828    Value* carry_out = genShiftHighbitToLow(strm_value, "carry_out");
    831829    //CarryQ - carry out:
    832     Value* void_1 = genCarryOutStore(carry_out, mptr_carry_q, this_carry_idx);
     830    genCarryOutStore(carry_out, mptr_carry_q, this_carry_idx);
    833831
    834832    return result_value;
Note: See TracChangeset for help on using the changeset viewer.