Ignore:
Timestamp:
Mar 24, 2017, 4:01:22 PM (2 years ago)
Author:
nmedfort
Message:

Bug fix for long advance

File:
1 edited

Legend:

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

    r5368 r5371  
    33
    44#include <pablo/pabloAST.h>
    5 #include <pablo/pe_string.h>
    65
    76namespace pablo {
    87
    9 class Phi : public Variadic {
     8class Phi : public PabloAST {
    109    friend class PabloBlock;
    1110public:
     
    1817    virtual ~Phi(){
    1918    }
     19    void addIncomingValue(PabloAST * const value) {
     20        assert (getType() == value->getType());
     21        for (unsigned i = 0; i < getNumIncomingValues(); ++i) {
     22            if (LLVM_UNLIKELY(getIncomingValue(i) == value)) {
     23                return;
     24            }
     25        }
     26        assert (mNumIncomingValues < 2);
     27        mIncomingValue[mNumIncomingValues++] = value;
     28    }
    2029    PabloAST * getIncomingValue(const unsigned i) const {
    21         return getOperand(i);
     30        assert (i < mNumIncomingValues);
     31        return mIncomingValue[i];
     32    }
     33    unsigned getNumIncomingValues() const {
     34        return mNumIncomingValues;
    2235    }
    2336protected:
    24     Phi(llvm::Type * type, const unsigned NumReservedValues, const String * const name, Allocator & allocator)
    25     : Variadic(ClassTypeId::Phi, type, NumReservedValues, name, allocator) {
     37    Phi(llvm::Type * type, Allocator & allocator)
     38    : PabloAST(ClassTypeId::Phi, type, allocator)
     39    , mNumIncomingValues(0) {
    2640
    2741    }
     42private:
     43    unsigned   mNumIncomingValues;
     44    PabloAST * mIncomingValue[2];
    2845};
    2946
Note: See TracChangeset for help on using the changeset viewer.