Changeset 4568 for icGREP


Ignore:
Timestamp:
May 20, 2015, 12:27:09 PM (4 years ago)
Author:
cameron
Message:

Abstract conditions for if-summary computation

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
2 edited

Legend:

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

    r4566 r4568  
    9090    }
    9191   
     92    bool blockHasCarries() const { return totalCarryDataSize > 0;}
     93   
     94    bool explicitSummaryRequired() const { return totalCarryDataSize > 1;}
     95   
     96    bool summaryNeededInParentBlock() const {return (ifDepth > 0) && blockHasCarries();}
     97   
    9298    unsigned summaryCarryDataIndex()  const {
    9399        return blockCarryDataIndex + totalCarryDataSize - 1;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4567 r4568  
    442442   
    443443        const unsigned baseCarryDataIdx = cd.getBlockCarryDataIndex();
    444         const unsigned carryDataSize = cd.getTotalCarryDataSize();
    445444        const unsigned carrySummaryIndex = cd.summaryCarryDataIndex();
    446445       
    447446        Value* if_test_value = compileExpression(ifStatement->getCondition());
    448         if (carryDataSize > 0) {
     447        if (cd.blockHasCarries()) {
    449448            // load the summary variable
    450449            Value* last_if_pending_data = genCarryDataLoad(carrySummaryIndex);
     
    463462        // carry over variable.
    464463       
    465         if (carryDataSize > 1) {
     464        if (cd.explicitSummaryRequired()) {
    466465            // If there was only one carry entry, then it also serves as the summary variable.
    467466            // Otherwise, we need to combine entries to compute the summary.
     
    494493            mMarkerMap[assign] = phi;
    495494        }
    496         // Create the phi Node for the summary variable.
    497         if (carryDataSize > 0) {
     495        // Create the phi Node for the summary variable, if needed.
     496        if (cd.summaryNeededInParentBlock()) {
    498497            PHINode * summary_phi = bEnd.CreatePHI(mBitBlockType, 2, "summary");
    499498            summary_phi->addIncoming(mZeroInitializer, ifEntryBlock);
Note: See TracChangeset for help on using the changeset viewer.