Ignore:
Timestamp:
Feb 2, 2016, 4:02:08 PM (4 years ago)
Author:
nmedfort
Message:

Slight optimization for Simplifier; major change to CarryManager? to build summary variables whenever a carry operation is performed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/carry_data.h

    r4715 r4925  
    4545class PabloBlock;
    4646
    47 class PabloBlockCarryData {
     47class CarryData {
    4848public:
    49     PabloBlockCarryData(PabloBlock * b, unsigned PACK_SIZE, unsigned ITEMS_PER_PACK):
    50                            mPACK_SIZE(PACK_SIZE),
    51                            mITEMS_PER_PACK(ITEMS_PER_PACK),
    52                            mPOSITIONS_PER_BLOCK(mITEMS_PER_PACK * (BLOCK_SIZE/mPACK_SIZE)),
    53                            theScope(b), framePosition(0),
    54                            ifDepth(0), whileDepth (0), maxNestingDepth(0),
    55                            longAdvance({0, 0, 0}),
    56                            shortAdvance({0, 0, 0}),
    57                            advance1({0, 0}),
    58                            addWithCarry({0, 0}),
    59                            nested({0, 0, 0}),
    60                            summary({0, 0}),
    61                            scopeCarryDataSize(0)
    62     {enumerateLocal();}
    63        
     49
     50    CarryData(PabloBlock * b, unsigned PACK_SIZE, unsigned ITEMS_PER_PACK):
     51       mPackSize(PACK_SIZE),
     52       mItemsPerPack(ITEMS_PER_PACK),
     53       mPositionsPerBlock(mItemsPerPack * (BLOCK_SIZE/mPackSize)),
     54       theScope(b),
     55       framePosition(0),
     56       ifDepth(0),
     57       whileDepth (0),
     58       maxNestingDepth(0),
     59       longAdvance({0, 0, 0}),
     60       shortAdvance({0, 0, 0}),
     61       unitAdvance({0, 0}),
     62       addWithCarry({0, 0}),
     63       nested({0, 0, 0}),
     64       summary({0, 0}),
     65       scopeCarryDataSize(0)
     66    {
     67        enumerateLocal();
     68    }
     69
    6470    friend class CarryManager;
    6571   
    66     inline unsigned roomInFinalPack(unsigned allocatedBits) {
    67         return mITEMS_PER_PACK - (allocatedBits % mITEMS_PER_PACK);
     72    inline unsigned roomInFinalPack(unsigned allocatedBits) const {
     73        return mItemsPerPack - (allocatedBits % mItemsPerPack);
    6874    }
    6975   
    7076    void enumerateLocal();
     77
    7178    void dumpCarryData(llvm::raw_ostream & strm);
    7279   
     
    103110    }
    104111   
    105     bool blockHasLongAdvances() const { return longAdvance.entries > 0;}
     112    bool hasLongAdvances() const { return longAdvance.entries > 0;}
    106113   
    107114    unsigned getLocalCarryPackIndex () {
    108         return shortAdvance.frameOffset / mITEMS_PER_PACK;
     115        return shortAdvance.frameOffset / mItemsPerPack;
    109116    }
    110117
    111118    unsigned getLocalCarryPackCount () {
    112         return fullOrPartialBlocks(nested.frameOffset, mITEMS_PER_PACK) - shortAdvance.frameOffset / mITEMS_PER_PACK;
     119        return fullOrPartialBlocks(nested.frameOffset, mItemsPerPack) - shortAdvance.frameOffset / mItemsPerPack;
    113120    }
    114121   
    115122    unsigned getScopeCarryPackCount () {
    116         return fullOrPartialBlocks(scopeCarryDataSize, mITEMS_PER_PACK);
     123        return fullOrPartialBlocks(scopeCarryDataSize, mItemsPerPack);
    117124    }
    118125   
    119     bool blockHasCarries() const { return scopeCarryDataSize > 0;}
     126    bool hasCarries() const { return scopeCarryDataSize > 0;}
    120127   
    121128    bool explicitSummaryRequired() const {
    122         return (ifDepth > 0) && (scopeCarryDataSize > mITEMS_PER_PACK);
     129        return (ifDepth > 0) && (scopeCarryDataSize > mItemsPerPack);
    123130    }
    124131   
    125132protected:
    126    
    127     unsigned mPACK_SIZE, mITEMS_PER_PACK, mPOSITIONS_PER_BLOCK;
     133
     134    unsigned mPackSize, mItemsPerPack, mPositionsPerBlock;
    128135   
    129136    PabloBlock * theScope;
     
    137144    struct {unsigned frameOffset; unsigned entries; unsigned allocatedBitBlocks;} longAdvance;
    138145    struct {unsigned frameOffset; unsigned entries; unsigned allocatedBits;} shortAdvance;
    139     struct {unsigned frameOffset; unsigned entries;} advance1;
     146    struct {unsigned frameOffset; unsigned entries;} unitAdvance;
    140147    struct {unsigned frameOffset; unsigned entries;} addWithCarry;
    141148    struct {unsigned frameOffset; unsigned entries; unsigned allocatedBits;} nested;
     
    143150
    144151    unsigned scopeCarryDataSize;
    145    
    146     llvm::Value * ifEntryPack;
    147152   
    148153};
Note: See TracChangeset for help on using the changeset viewer.