Changeset 4260


Ignore:
Timestamp:
Oct 23, 2014, 7:03:21 AM (3 years ago)
Author:
cameron
Message:

Update pablo Advance object to take integer shift amount; not supported by compiler yet

Location:
icGREP/icgrep-devel/icgrep
Files:
8 edited

Legend:

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

    r4252 r4260  
    100100            break;
    101101        }
    102         assignment = mCG.createAssign("seq", mCG.createAdvance(result));
     102        assignment = mCG.createAssign("seq", mCG.createAdvance(result, 1));
    103103    }
    104104    return result;
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r4258 r4260  
    1212/// UNARY CREATE FUNCTIONS
    1313
    14 PabloAST * PabloBlock::createAdvance(PabloAST * expr) {
     14PabloAST * PabloBlock::createAdvance(PabloAST * expr, int shiftAmount) {
    1515    if (isa<Zeroes>(expr)) {
    1616        return expr;
    1717    }
    18     return mUnary.findOrMake<Advance>(PabloAST::ClassTypeId::Advance, expr);
     18    return mUnaryWithInt.findOrMake<Advance>(PabloAST::ClassTypeId::Advance, expr, shiftAmount);
    1919}
    2020
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r4258 r4260  
    4444    , mSymbolGenerator(symgen)
    4545    , mUnary(nullptr, this)
     46    , mUnaryWithInt(nullptr, this)
    4647    , mBinary(nullptr, this)
    4748    , mTernary(nullptr, this)
     
    5556    , mSymbolGenerator(cg.mSymbolGenerator)
    5657    , mUnary(&(cg.mUnary), this)
     58    , mUnaryWithInt(&(cg.mUnaryWithInt), this)
    5759    , mBinary(&(cg.mBinary), this)
    5860    , mTernary(&(cg.mTernary), this)
     
    6163    }
    6264
    63     PabloAST * createAdvance(PabloAST * expr);
     65    PabloAST * createAdvance(PabloAST * expr, int shiftAmount);
    6466
    6567    inline Zeroes * createZeroes() const {
     
    213215    SymbolGenerator &                                   mSymbolGenerator;
    214216    ExpressionMap<PabloAST *>                           mUnary;
     217    ExpressionMap<PabloAST *, int>                      mUnaryWithInt;
    215218    ExpressionMap<PabloAST *, PabloAST *>               mBinary;
    216219    ExpressionMap<PabloAST *, PabloAST *, PabloAST *>   mTernary;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4258 r4260  
    704704    {
    705705        Value* strm_value = compileExpression(adv->getExpr());
    706         retVal = genAdvanceWithCarry(strm_value);
     706                int shift = adv->getAdvanceAmount();
     707        retVal = genAdvanceWithCarry(strm_value, shift);
    707708    }
    708709    else if (const MatchStar * mstar = dyn_cast<MatchStar>(expr))
     
    828829}
    829830
    830 Value* PabloCompiler::genAdvanceWithCarry(Value* strm_value) {
     831Value* PabloCompiler::genAdvanceWithCarry(Value* strm_value, int shift_amount) {
     832        if (shift_amount != 1) {
     833                throw std::runtime_error("Shift amount != 1 in Advance is currently unsupported.");
     834        }
     835       
    831836    IRBuilder<> b(mBasicBlock);
    832837#if (BLOCK_SIZE == 128)
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h

    r4258 r4260  
    108108    void   genCarryOutStore(Value* carryOut, const unsigned index);
    109109    Value* genAddWithCarry(Value* e1, Value* e2);
    110     Value* genAdvanceWithCarry(Value* e1);
     110    Value* genAdvanceWithCarry(Value* e1, int shift_amount);
    111111    Value* genBitBlockAny(Value* test);
    112112    Value* genShiftHighbitToLow(Value* e, const Twine & namehint = "");
  • icGREP/icgrep-devel/icgrep/pablo/pe_advance.h

    r4244 r4260  
    2626        return mExpr;
    2727    }
     28    inline int getAdvanceAmount() const {
     29        return mShiftAmount;
     30    }
    2831protected:
    29     Advance(PabloAST * expr)
     32    Advance(PabloAST * expr, int shiftAmount)
    3033    : PabloAST(ClassTypeId::Advance)
    31     , mExpr(expr) {
     34    , mExpr(expr)
     35        , mShiftAmount(shiftAmount) {
    3236
    3337    }
    3438private:
    3539    PabloAST * const mExpr;
     40        int const mShiftAmount;
    3641};
    3742
  • icGREP/icgrep-devel/icgrep/pablo/printer_pablos.cpp

    r4257 r4260  
    113113    }
    114114    else if (const Advance * adv = dyn_cast<const Advance>(expr)) {
    115         return "Advance(" + ShowPabloAST(adv->getExpr()) + ")";
     115        return "Advance(" + ShowPabloAST(adv->getExpr()) + ", " + std::to_string(adv->getAdvanceAmount()) + ")";
    116116    }
    117117    else if (const MatchStar * mstar = dyn_cast<const MatchStar>(expr)) {
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4256 r4260  
    5757        mNonFinal = pb.createVar(pb.createAssign(gs_nonfinal, pb.createZeroes()));
    5858        #endif
    59         PabloAST * u8scope32 = pb.createAdvance(u8pfx3);
    60         PabloAST * u8scope42 = pb.createAdvance(u8pfx4);
    61         PabloAST * u8scope43 = pb.createAdvance(u8scope42);
     59        PabloAST * u8scope32 = pb.createAdvance(u8pfx3, 1);
     60        PabloAST * u8scope42 = pb.createAdvance(u8pfx4, 1);
     61        PabloAST * u8scope43 = pb.createAdvance(u8scope42, 1);
    6262        #ifdef USE_IF_FOR_NONFINAL
    6363        PabloBlock it(pb);
     
    100100        marker = pb.createScanThru(marker, mNonFinal);
    101101        PabloAST * dot = pb.createNot(mLineFeed);
    102         target = pb.createAssign("dot", pb.createAdvance(pb.createAnd(marker, dot)));
     102        target = pb.createAssign("dot", pb.createAdvance(pb.createAnd(marker, dot), 1));
    103103    }
    104104    else if (Diff * diff = dyn_cast<Diff>(re)) {
     
    106106    }
    107107    else if (isa<Start>(re)) {
    108         PabloAST * const sol = pb.createNot(pb.createAdvance(pb.createNot(mLineFeed)));
     108        PabloAST * const sol = pb.createNot(pb.createAdvance(pb.createNot(mLineFeed), 1));
    109109        target = pb.createAssign("sol", pb.createAnd(pb.createVar(target), sol));
    110110    }
     
    129129        cc = pb.createVar(name->getName());
    130130    }
    131     return pb.createAssign("m", pb.createAdvance(pb.createAnd(cc, marker)));
     131    return pb.createAssign("m", pb.createAdvance(pb.createAnd(cc, marker), 1));
    132132}
    133133
Note: See TracChangeset for help on using the changeset viewer.