Changeset 4257


Ignore:
Timestamp:
Oct 21, 2014, 11:05:04 PM (5 years ago)
Author:
nmedfort
Message:

Pablo Compiler now generates phi nodes created for carry variables. zStarHeight showed 33% improvement. Had to manually merge in last check-in's changes.

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

Legend:

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

    r4255 r4257  
    66
    77#include <pablo/codegenstate.h>
     8#include <iostream>
    89
    910namespace pablo {
     
    1213
    1314PabloAST * PabloBlock::createAdvance(PabloAST * expr) {
    14 //    if (isa<Zeroes>(expr)) {
    15 //        return createZeroes();
    16 //    }
     15    if (isa<Zeroes>(expr)) {
     16        return expr;
     17    }
    1718    return mUnary.findOrMake<Advance>(PabloAST::ClassTypeId::Advance, expr);
    1819}
     
    2324
    2425PabloAST * PabloBlock::createNot(PabloAST * expr) {
    25 //    if (isa<Zeroes>(expr)) {
    26 //        return createOnes();
    27 //    }
    28 //    else if (isa<Ones>(expr)) {
    29 //        return createZeroes();
    30 //    }
    3126    return mUnary.findOrCall<OptimizeNot>(PabloAST::ClassTypeId::Not, expr);
    3227}
     
    4540
    4641PabloAST * PabloBlock::createMatchStar(PabloAST * marker, PabloAST * charclass) {
    47 //    if (isa<Zeroes>(marker)) {
    48 //        return createZeroes();
    49 //    }
    50 //    else if (isa<Zeroes>(charclass)) {
    51 //        return marker;
    52 //    }
     42    if (isa<Zeroes>(marker) || isa<Zeroes>(charclass)) {
     43        return marker;
     44    }
    5345    return mBinary.findOrMake<MatchStar>(PabloAST::ClassTypeId::MatchStar, marker, charclass);
    5446}
    5547
    5648PabloAST * PabloBlock::createScanThru(PabloAST * from, PabloAST * thru) {
    57 //    if (isa<Zeroes>(from)) {
    58 //        return createZeroes();
    59 //    }
    60 //    else if (isa<Zeroes>(thru)) {
    61 //        return marker;
    62 //    }
     49    if (isa<Zeroes>(from) || isa<Zeroes>(thru)) {
     50        return from;
     51    }
    6352    return mBinary.findOrMake<ScanThru>(PabloAST::ClassTypeId::ScanThru, from, thru);
    6453}
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4255 r4257  
    8585, mCarryQueueIdx(0)
    8686, mCarryQueuePtr(nullptr)
     87, mNestingDepth(0)
    8788, mCarryQueueSize(0)
    8889, mZeroInitializer(ConstantAggregateZero::get(mXi64Vect))
     
    145146}
    146147
    147 LLVM_Gen_RetVal PabloCompiler::compile(const PabloBlock & pb)
     148LLVM_Gen_RetVal PabloCompiler::compile(PabloBlock & pb)
    148149{
    149150    mCarryQueueSize = 0;
    150151    DeclareCallFunctions(pb.expressions());
     152    mCarryQueueVector.resize(mCarryQueueSize);
    151153
    152154    Function::arg_iterator args = mFunc_process_block->arg_begin();
     
    160162    //Create the carry queue.
    161163    mCarryQueueIdx = 0;
     164    mNestingDepth = 0;
    162165    mBasicBlock = BasicBlock::Create(mMod->getContext(), "parabix_entry", mFunc_process_block,0);
    163166
     
    166169        IRBuilder<> b(mBasicBlock);
    167170        Value* indices[] = {b.getInt64(0), b.getInt32(i)};
    168         const std::string name = mBasisBitVars[i]->getName();
    169         mMarkerMap.insert(make_pair(name, b.CreateGEP(mBasisBitsAddr, indices, name)));
     171        const String * const name = mBasisBitVars[i]->getName();
     172        mMarkerMap.insert(std::make_pair(name, b.CreateGEP(mBasisBitsAddr, indices, name->str())));
    170173    }
    171174
    172175    //Generate the IR instructions for the function.
    173     SetReturnMarker(compileStatements(pb.expressions()), 0); // matches
    174     SetReturnMarker(GetMarker(mNameMap["LineFeed"]->getName()), 1); // line feeds
     176    Value * result = compileStatements(pb.expressions());
     177    SetReturnMarker(result, 0); // matches
     178
     179    const String * lf = pb.createVar(mNameMap["LineFeed"]->getName())->getName();
     180
     181    SetReturnMarker(GetMarker(lf), 1); // line feeds
    175182
    176183    assert (mCarryQueueIdx == mCarryQueueSize);
    177 
     184    assert (mNestingDepth == 0);
    178185    //Terminate the block
    179186    ReturnInst::Create(mMod->getContext(), mBasicBlock);
     
    372379            DeclareCallFunctions(next->getExpr());
    373380        }
    374         else if (If * ifstmt = dyn_cast<If>(stmt)) {
    375             DeclareCallFunctions(ifstmt->getCondition());
    376             DeclareCallFunctions(ifstmt->getBody());
    377         }
    378         else if (While * whl = dyn_cast<While>(stmt)) {
    379             DeclareCallFunctions(whl->getCondition());
    380             DeclareCallFunctions(whl->getBody());
     381        else if (If * ifStatement = dyn_cast<If>(stmt)) {
     382            const auto preIfCarryCount = mCarryQueueSize;
     383            DeclareCallFunctions(ifStatement->getCondition());
     384            DeclareCallFunctions(ifStatement->getBody());
     385            ifStatement->setInclusiveCarryCount(mCarryQueueSize - preIfCarryCount);
     386        }
     387        else if (While * whileStatement = dyn_cast<While>(stmt)) {
     388            const auto preWhileCarryCount = mCarryQueueSize;
     389            DeclareCallFunctions(whileStatement->getCondition());
     390            DeclareCallFunctions(whileStatement->getBody());
     391            whileStatement->setInclusiveCarryCount(mCarryQueueSize - preWhileCarryCount);
    381392        }
    382393    }
     
    385396void PabloCompiler::DeclareCallFunctions(const PabloAST * expr)
    386397{
    387     if (const Call * pablo_call = dyn_cast<const Call>(expr)) {
    388         const std::string callee = pablo_call->getCallee();
     398    if (const Call * call = dyn_cast<const Call>(expr)) {
     399        const String * const callee = call->getCallee();
     400        assert (callee);
    389401        if (mCalleeMap.find(callee) == mCalleeMap.end()) {
    390402            void * callee_ptr = nullptr;
    391403            #define CHECK_GENERAL_CODE_CATEGORY(SUFFIX) \
    392                 if (callee == #SUFFIX) { \
     404                if (callee->str() == #SUFFIX) { \
    393405                    callee_ptr = (void*)&__get_category_##SUFFIX; \
    394406                } else
     
    424436            CHECK_GENERAL_CODE_CATEGORY(Zs)
    425437            // OTHERWISE ...
    426             throw std::runtime_error("Unknown unicode category \"" + callee + "\"");
     438            throw std::runtime_error("Unknown unicode category \"" + callee->str() + "\"");
    427439            #undef CHECK_GENERAL_CODE_CATEGORY
    428             Value * unicodeCategory = mMod->getOrInsertFunction("__get_category_" + callee, mXi64Vect, mBasisBitsInputPtr, NULL);
     440            Value * unicodeCategory = mMod->getOrInsertFunction("__get_category_" + callee->str(), mXi64Vect, mBasisBitsInputPtr, NULL);
    429441            if (unicodeCategory == nullptr) {
    430                 throw std::runtime_error("Could not create static method call for unicode category \"" + callee + "\"");
     442                throw std::runtime_error("Could not create static method call for unicode category \"" + callee->str() + "\"");
    431443            }
    432444            mExecutionEngine->addGlobalMapping(cast<GlobalValue>(unicodeCategory), callee_ptr);
     
    473485}
    474486
    475 inline Value* PabloCompiler::GetMarker(const std::string & name) {
     487inline Value* PabloCompiler::GetMarker(const String * name) {
    476488    auto itr = mMarkerMap.find(name);
    477489    if (itr == mMarkerMap.end()) {
    478490        IRBuilder<> b(mBasicBlock);
    479         itr = mMarkerMap.insert(make_pair(name, b.CreateAlloca(mXi64Vect))).first;
     491        itr = mMarkerMap.insert(std::make_pair(name, b.CreateAlloca(mXi64Vect))).first;
    480492    }
    481493    return itr->second;
     
    484496void PabloCompiler::SetReturnMarker(Value * marker, const unsigned index) {
    485497    IRBuilder<> b(mBasicBlock);
    486     Value* marker_bitblock = b.CreateLoad(marker);
     498    Value* marker_bitblock = b.CreateAlignedLoad(marker, BLOCK_SIZE/8, false);
    487499    Value* output_indices[] = {b.getInt64(0), b.getInt32(index)};
    488500    Value* output_struct_GEP = b.CreateGEP(mOutputAddrPtr, output_indices);
    489     b.CreateStore(marker_bitblock, output_struct_GEP);
     501    b.CreateAlignedStore(marker_bitblock, output_struct_GEP, BLOCK_SIZE/8, false);
    490502}
    491503
     
    507519        Value * marker = GetMarker(assign->getName());
    508520        IRBuilder<> b(mBasicBlock);
    509         b.CreateStore(expr, marker)->setAlignment(BLOCK_SIZE / 8);
     521        b.CreateAlignedStore(expr, marker, BLOCK_SIZE/8, false);
    510522        retVal = marker;
    511523    }
     
    517529        Value * marker = f->second;
    518530        Value * expr = compileExpression(next->getExpr());
    519         b.CreateStore(expr, marker, false)->setAlignment(BLOCK_SIZE / 8);
     531        b.CreateAlignedStore(expr, marker, BLOCK_SIZE/8, false);
    520532        retVal = marker;
    521533    }
     
    535547        IRBuilder<> b_ifbody(ifBodyBlock);
    536548        mBasicBlock = ifBodyBlock;
     549
     550        ++mNestingDepth;
    537551
    538552        Value *  returnMarker = compileStatements(ifstmt->getBody());
     
    543557            int if_accum_idx = mCarryQueueIdx++;
    544558
    545             Value* if_carry_accum_value = genCarryInLoad(mCarryQueuePtr, if_start_idx);
     559            Value* if_carry_accum_value = genCarryInLoad(if_start_idx);
    546560
    547561            for (int c = if_start_idx+1; c < if_end_idx; c++)
    548562            {
    549                 Value* carryq_value = genCarryInLoad(mCarryQueuePtr, c);
     563                Value* carryq_value = genCarryInLoad(c);
    550564                if_carry_accum_value = b_ifbody.CreateOr(carryq_value, if_carry_accum_value);
    551565            }
    552             genCarryOutStore(if_carry_accum_value, mCarryQueuePtr, if_accum_idx);
     566            genCarryOutStore(if_carry_accum_value, if_accum_idx);
    553567
    554568        }
     
    560574            // Have at least one internal carry.
    561575            int if_accum_idx = mCarryQueueIdx - 1;
    562             Value* last_if_pending_carries = genCarryInLoad(mCarryQueuePtr, if_accum_idx);
     576            Value* last_if_pending_carries = genCarryInLoad(if_accum_idx);
    563577            if_test_value = b_entry.CreateOr(if_test_value, last_if_pending_carries);
    564578        }
     
    566580
    567581        mBasicBlock = ifEndBlock;
     582        --mNestingDepth;
    568583
    569584        retVal = returnMarker;
     
    571586    else if (const While* whl = dyn_cast<const While>(stmt))
    572587    {
    573         int idx = mCarryQueueIdx;
    574 
    575         //With this call to the while body we will account for all of the carry in values.
     588        BasicBlock* entryBlock = mBasicBlock;
     589
     590        const auto baseCarryQueueIdx = mCarryQueueIdx;
     591        if (mNestingDepth == 0) {
     592            for (auto i = 0; i != whl->getInclusiveCarryCount(); ++i) {
     593                genCarryInLoad(baseCarryQueueIdx + i);
     594            }
     595        }       
     596
     597        // First compile the initial iteration statements; the calls to genCarryOutStore will update the
     598        // mCarryQueueVector with the appropriate values.
     599        ++mNestingDepth;
    576600        Value * returnMarker = compileStatements(whl->getBody());
    577601
    578         BasicBlock*  whileCondBlock = BasicBlock::Create(mMod->getContext(), "while.cond", mFunc_process_block, 0);
    579         BasicBlock*  whileBodyBlock = BasicBlock::Create(mMod->getContext(), "while.body", mFunc_process_block, 0);
    580         BasicBlock*  whileEndBlock = BasicBlock::Create(mMod->getContext(), "while.end", mFunc_process_block, 0);
     602        mCarryQueueIdx = baseCarryQueueIdx;
     603
     604        BasicBlock* whileCondBlock = BasicBlock::Create(mMod->getContext(), "while.cond", mFunc_process_block, 0);
     605        BasicBlock* whileBodyBlock = BasicBlock::Create(mMod->getContext(), "while.body", mFunc_process_block, 0);
     606        BasicBlock* whileEndBlock = BasicBlock::Create(mMod->getContext(), "while.end", mFunc_process_block, 0);
    581607
    582608        IRBuilder<> b(mBasicBlock);
    583609        b.CreateBr(whileCondBlock);
     610
     611        // CONDITION BLOCK
     612        IRBuilder<> bCond(whileCondBlock);
     613        // generate phi nodes for any carry propogating instruction
     614        std::vector<PHINode*> carryQueuePhiNodes(whl->getInclusiveCarryCount());
     615        for (auto i = 0; i != whl->getInclusiveCarryCount(); ++i) {
     616            PHINode * phi = bCond.CreatePHI(mXi64Vect, 2);
     617            phi->addIncoming(mCarryQueueVector[baseCarryQueueIdx + i], mBasicBlock);
     618            mCarryQueueVector[baseCarryQueueIdx + i] = mZeroInitializer; // phi;
     619            carryQueuePhiNodes[i] = phi;
     620        }
     621
    584622        mBasicBlock = whileCondBlock;
    585         IRBuilder<> b_cond(whileCondBlock);
    586 
    587         Value* expression_marker_value = compileExpression(whl->getCondition());
    588         Value* int_tobool1 = genBitBlockAny(expression_marker_value);
    589 
    590         b_cond.CreateCondBr(int_tobool1, whileEndBlock, whileBodyBlock);
    591 
     623        bCond.CreateCondBr(genBitBlockAny(compileExpression(whl->getCondition())), whileEndBlock, whileBodyBlock);
     624
     625        // BODY BLOCK
    592626        mBasicBlock = whileBodyBlock;
    593         mCarryQueueIdx = 0;
    594         //Store the current carry queue.
    595         Value* ptr_last_carry_q = mCarryQueuePtr;
    596 
    597         IRBuilder<> b_wb1(mBasicBlock);
    598         //Create and initialize a new carry queue.
    599         Value * ptr_while_carry_q = b_wb1.CreateAlloca(mXi64Vect, b_wb1.getInt64(mCarryQueueSize - idx));
    600         for (int i = 0; i < (mCarryQueueSize - idx); i++) {
    601             genCarryOutStore(mZeroInitializer, ptr_while_carry_q, i);
    602         }
    603 
    604         //Point mptr_carry_q to the new local carry queue.
    605         mCarryQueuePtr = ptr_while_carry_q;
    606 
    607627        returnMarker = compileStatements(whl->getBody());
    608 
    609         IRBuilder<> b_wb2(mBasicBlock);
    610         //Copy back to the last carry queue the carries from the execution of the while statement list.
    611         for (int c = 0; c < (mCarryQueueSize - idx); c++)
    612         {
    613             Value* new_carryq_value = b_wb2.CreateOr(genCarryInLoad(mCarryQueuePtr, c), genCarryInLoad(ptr_last_carry_q, idx + c));
    614             genCarryOutStore(new_carryq_value, ptr_last_carry_q, idx + c);
    615         }
    616 
    617         b_wb2.CreateBr(whileCondBlock);
    618 
    619         mBasicBlock = whileEndBlock;
    620         mCarryQueuePtr = ptr_last_carry_q;
    621         mCarryQueueIdx += idx;
    622 
     628        // update phi nodes for any carry propogating instruction
     629        IRBuilder<> bWhileBody(mBasicBlock);
     630        for (auto i = 0; i != whl->getInclusiveCarryCount(); ++i) {
     631            Value * carryOut = bWhileBody.CreateOr(carryQueuePhiNodes[i], mCarryQueueVector[baseCarryQueueIdx + i]);
     632            carryQueuePhiNodes[i]->addIncoming(carryOut, mBasicBlock);
     633            mCarryQueueVector[baseCarryQueueIdx + i] = carryQueuePhiNodes[i];
     634        }
     635
     636        bWhileBody.CreateBr(whileCondBlock);
     637
     638        // EXIT BLOCK
     639        mBasicBlock = whileEndBlock;   
     640        if (--mNestingDepth == 0) {
     641            for (auto i = 0; i != whl->getInclusiveCarryCount(); ++i) {
     642                genCarryOutStore(carryQueuePhiNodes[i], baseCarryQueueIdx + i);
     643            }
     644        }
    623645        retVal = returnMarker;
    624646    }
     
    642664            auto ci = mCalleeMap.find(call->getCallee());
    643665            if (ci == mCalleeMap.end()) {
    644                 throw std::runtime_error("Unexpected error locating static function for \"" + call->getCallee() + "\"");
     666                throw std::runtime_error("Unexpected error locating static function for \"" + call->getCallee()->str() + "\"");
    645667            }
    646668            Value * unicode_category = b.CreateCall(ci->second, mBasisBitsAddr);
    647669            Value * ptr = b.CreateAlloca(mXi64Vect);
    648             b.CreateStore(unicode_category, ptr)->setAlignment(BLOCK_SIZE / 8);
     670            b.CreateAlignedStore(unicode_category, ptr, BLOCK_SIZE/8, false);
    649671            mi = mMarkerMap.insert(std::make_pair(call->getCallee(), ptr)).first;
    650672        }
    651         LoadInst * li = b.CreateLoad(mi->second, false, call->getCallee());
    652         li->setAlignment(BLOCK_SIZE/8);
    653         retVal = li;
     673        retVal = b.CreateAlignedLoad(mi->second, BLOCK_SIZE/8, false, call->getCallee()->str() );
    654674    }
    655675    else if (const Var * var = dyn_cast<Var>(expr))
     
    657677        auto f = mMarkerMap.find(var->getName());
    658678        assert (f != mMarkerMap.end());
    659         LoadInst * li = b.CreateLoad(f->second, false, var->getName());
    660         li->setAlignment(BLOCK_SIZE/8);
    661         retVal = li;
     679        retVal = b.CreateAlignedLoad(f->second, BLOCK_SIZE/8, false, var->getName()->str() );
    662680    }
    663681    else if (const And * pablo_and = dyn_cast<And>(expr))
     
    732750    //CarryQ - carry in.
    733751    const int carryIdx = mCarryQueueIdx++;
    734     Value* carryq_value = genCarryInLoad(mCarryQueuePtr, carryIdx);
     752    Value* carryq_value = genCarryInLoad(carryIdx);
    735753
    736754#ifdef USE_UADD_OVERFLOW
     
    761779    Value* carry_out = genShiftHighbitToLow(b.CreateOr(carrygen, b.CreateAnd(carryprop, genNot(sum))), "carry_out");
    762780#endif
    763     genCarryOutStore(carry_out, mCarryQueuePtr, carryIdx);
     781    genCarryOutStore(carry_out, carryIdx);
    764782    return sum;
    765783}
    766784
    767 LoadInst* PabloCompiler::genCarryInLoad(Value* ptr_carry_q, const unsigned index) {
    768     IRBuilder<> b(mBasicBlock);
    769     LoadInst * result = b.CreateLoad(b.CreateGEP(ptr_carry_q, b.getInt64(index)));
    770     result->setAlignment(BLOCK_SIZE / 8);
    771     return result;
    772 }
    773 
    774 StoreInst* PabloCompiler::genCarryOutStore(Value* carryout, Value* ptr_carry_q, const unsigned index ) {
    775     IRBuilder<> b(mBasicBlock);
    776     StoreInst * result = b.CreateStore(carryout, b.CreateGEP(ptr_carry_q, b.getInt64(index)));
    777     result->setAlignment(BLOCK_SIZE / 8);
    778     return result;
     785Value* PabloCompiler::genCarryInLoad(const unsigned index) {
     786    IRBuilder<> b(mBasicBlock);
     787    if (mNestingDepth == 0) {
     788        LoadInst * carryIn = b.CreateAlignedLoad(b.CreateGEP(mCarryQueuePtr, b.getInt64(index)), BLOCK_SIZE/8, false);
     789        mCarryQueueVector[index] = carryIn;
     790        return carryIn;
     791    }
     792    else { // we're in a potentially-nested while/if block
     793        assert (index < mCarryQueueVector.size());
     794        return mCarryQueueVector[index];
     795    }
     796}
     797
     798void PabloCompiler::genCarryOutStore(Value* carryOut, const unsigned index ) {
     799    IRBuilder<> b(mBasicBlock);
     800    assert (carryOut);
     801    assert (index < mCarryQueueVector.size());
     802    if (mNestingDepth == 0) {
     803        b.CreateAlignedStore(carryOut, b.CreateGEP(mCarryQueuePtr, b.getInt64(index)), BLOCK_SIZE/8, false);
     804    }
     805    mCarryQueueVector[index] = carryOut;
    779806}
    780807
     
    805832    IRBuilder<> b(mBasicBlock);
    806833#if (BLOCK_SIZE == 128)
    807     int this_carry_idx = mCarryQueueIdx;
    808     mCarryQueueIdx++;
    809 
    810     Value* carryq_value = genCarryInLoad(mCarryQueuePtr, this_carry_idx);
    811 
     834    const auto carryIdx = mCarryQueueIdx++;
     835    Value* carryq_value = genCarryInLoad(carryIdx);
    812836    Value* srli_1_value = b.CreateLShr(strm_value, 63);
    813 
    814837    Value* packed_shuffle;
    815838    Constant* const_packed_1_elems [] = {b.getInt32(0), b.getInt32(2)};
     
    825848    Value* carry_out = genShiftHighbitToLow(strm_value, "carry_out");
    826849    //CarryQ - carry out:
    827     genCarryOutStore(carry_out, mCarryQueuePtr, this_carry_idx);
     850    genCarryOutStore(carry_out, carryIdx);
    828851
    829852    return result_value;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h

    r4253 r4257  
    8383    };
    8484    #endif
     85
     86    typedef std::unordered_map<const pablo::String *, Value*>   StringToValueMap;
     87    typedef std::vector<Value*>                                 CarryQueueVector;
     88
    8589public:
    8690    typedef cc::CC_Compiler::BasisBitVars BasisBitVars;
    8791    PabloCompiler(const cc::CC_NameMap & nameMap, const BasisBitVars & basisBitVars, int bits);
    8892    ~PabloCompiler();
    89     LLVM_Gen_RetVal compile(const PabloBlock & pb);
     93    LLVM_Gen_RetVal compile(PabloBlock & pb);
    9094private:
    9195    void DefineTypes();
     
    9599    void SetReturnMarker(Value * marker, const unsigned index);
    96100
    97     Value* GetMarker(const std::string & name);
     101    Value* GetMarker(const String *name);
    98102
    99103    Value* compileStatements(const ExpressionList & stmts);
     
    101105
    102106    Value* compileExpression(const PabloAST * expr);
    103     LoadInst* genCarryInLoad(Value* ptr_carry_q, const unsigned index);
    104     StoreInst* genCarryOutStore(Value * carryout, Value * ptr_carry_q, const unsigned index);
     107    Value* genCarryInLoad(const unsigned index);
     108    void   genCarryOutStore(Value* carryOut, const unsigned index);
    105109    Value* genAddWithCarry(Value* e1, Value* e2);
    106110    Value* genAdvanceWithCarry(Value* e1);
     
    114118    #endif
    115119
    116     std::map<std::string, Value*>       mCalleeMap;
    117     std::map<std::string, Value*>       mMarkerMap;
    118 
     120    StringToValueMap                    mMarkerMap;
     121    CarryQueueVector                    mCarryQueueVector;
    119122
    120123    int                                 mBits;   
     
    129132    PointerType*                        mBasisBitsInputPtr;
    130133
    131     int                                 mCarryQueueIdx;
     134    unsigned                            mCarryQueueIdx;
    132135    Value*                              mCarryQueuePtr;
    133 
    134     int                                 mCarryQueueSize;
     136    unsigned                            mNestingDepth;
     137    unsigned                            mCarryQueueSize;
    135138
    136139    ConstantAggregateZero* const        mZeroInitializer;
     
    144147    Value*                              mOutputAddrPtr;
    145148
     149    StringToValueMap                    mCalleeMap;
     150
    146151    const cc::CC_NameMap &              mNameMap;
    147152};
  • icGREP/icgrep-devel/icgrep/pablo/pe_call.h

    r4244 r4257  
    44#include <pablo/pabloAST.h>
    55#include <pablo/pe_string.h>
     6#include <iostream>
    67
    78namespace pablo {
     
    1819    virtual ~Call() {
    1920    }
    20     inline const std::string & getCallee() const {
    21         return *mCallee;
     21    inline const String * getCallee() const {
     22        return mCallee;
    2223    }
    2324protected:   
  • icGREP/icgrep-devel/icgrep/pablo/pe_next.h

    r4254 r4257  
    2121        return mInitial;
    2222    }
    23     inline const std::string & getName() const {
     23    inline const String * getName() const {
    2424        return mInitial->getName();
    2525    }
  • icGREP/icgrep-devel/icgrep/pablo/pe_string.h

    r4244 r4257  
    77namespace pablo {
    88
    9 class String : public PabloAST, public std::string {
    10     friend String * makeString(const std::string);
     9class String : public PabloAST {
     10    friend String * makeString(const std::string value) noexcept;
    1111public:
    1212    static inline bool classof(const PabloAST * e) {
     
    1919
    2020    }
    21     inline const std::string & getValue() const {
     21    inline const std::string & str() const {
     22        return mValue;
     23    }
     24    inline std::string str() {
    2225        return mValue;
    2326    }
    2427protected:
    25     String(const std::string string) noexcept
     28    String(const std::string && value) noexcept
    2629    : PabloAST(ClassTypeId::String)
    27     , std::string(string)
     30    , mValue(value)
    2831    {
    2932
     
    3336};
    3437
    35 inline String * makeString(const std::string string) {
    36     return new String(string);
     38inline String * makeString(const std::string value) noexcept {
     39    return new String(std::move(value));
    3740}
     41
    3842
    3943}
  • icGREP/icgrep-devel/icgrep/pablo/pe_var.h

    r4244 r4257  
    2525    virtual ~Var(){
    2626    }
    27     inline const std::string & getName() const {
    28         return *mVar;
     27    inline const String * getName() const {
     28        return mName;
    2929    }
    3030protected:
    3131    Var(const PabloAST * var)
    3232    : PabloAST(ClassTypeId::Var)
    33     , mVar(cast<String>(var)) {
     33    , mName(cast<String>(var)) {
    3434
    3535    }
    3636private:
    37     const String * const mVar;
     37    const String * const mName;
    3838};
    3939
  • icGREP/icgrep-devel/icgrep/pablo/printer_pablos.cpp

    r4253 r4257  
    7272{
    7373    if (const Assign * an = dyn_cast<const Assign>(stmt)) {
    74         return "Assign('" + an->getName() + "', " + ShowPabloAST(an->getExpr()) + "),";
     74        return "Assign('" + an->getName()->str() + "', " + ShowPabloAST(an->getExpr()) + "),";
    7575    }
    7676    else if (const Next * next = dyn_cast<const Next>(stmt)) {
    77         return "Next(" + next->getName() + ", " + ShowPabloAST(next->getExpr()) + ")";
     77        return "Next(" + next->getName()->str() + ", " + ShowPabloAST(next->getExpr()) + ")";
    7878    }
    7979    else if (const If * ifstmt = dyn_cast<const If>(stmt)) {
     
    9494    }
    9595    else if (const Call * pablo_call = dyn_cast<const Call>(expr)) {
    96         return "Call '" + pablo_call->getCallee() + "'";
     96        return "Call '" + pablo_call->getCallee()->str() + "'";
    9797    }
    9898    else if (const Var * pablo_var = dyn_cast<const Var>(expr)) {
    99         return "Var '" + pablo_var->getName() + "' ";
     99        return "Var '" + pablo_var->getName()->str() + "' ";
    100100    }
    101101    else if (const And * pablo_and = dyn_cast<const And>(expr)) {
  • icGREP/icgrep-devel/icgrep/pablo/ps_assign.h

    r4252 r4257  
    2424    virtual ~Assign() {
    2525    }
    26     inline const std::string & getName() const {
    27         return *mName;
     26    inline const String * getName() const {
     27        return mName;
    2828    }
    2929    inline PabloAST * getExpr() const {
  • icGREP/icgrep-devel/icgrep/pablo/ps_if.h

    r4253 r4257  
    2929        return mBody;
    3030    }
    31     inline void setCarryCount(const unsigned count) {
     31    inline void setInclusiveCarryCount(const unsigned count) {
    3232        mCarryCount = count;
    3333    }
    34     inline unsigned getCarryCount() const {
     34    inline unsigned getInclusiveCarryCount() const {
    3535        return mCarryCount;
    3636    }
  • icGREP/icgrep-devel/icgrep/pablo/ps_while.h

    r4253 r4257  
    2929        return mBody;
    3030    }
    31     inline void setCarryCount(const unsigned count) {
     31    inline void setInclusiveCarryCount(const unsigned count) {
    3232        mCarryCount = count;
    3333    }
    34     inline unsigned getCarryCount() const {
     34    inline unsigned getInclusiveCarryCount() const {
    3535        return mCarryCount;
    3636    }
  • icGREP/icgrep-devel/icgrep/pablo/symbol_generator.cpp

    r4252 r4257  
    2121    if (f == mStringMap.end()) {
    2222        result = makeString(name);
    23         mStringMap.insert(std::make_pair(name, result));
     23        mStringMap.insert(std::make_pair(std::move(name), result));
    2424    }
    2525    else {
  • icGREP/icgrep-devel/icgrep/re/re_parser.cpp

    r4256 r4257  
    248248}
    249249
    250 inline Name * RE_Parser::parse_unicode_category() {
     250Name * RE_Parser::parse_unicode_category() {
    251251    if (++_cursor != _end && *_cursor == '{') {
    252252        const cursor_t start = _cursor + 1;
Note: See TracChangeset for help on using the changeset viewer.