Ignore:
Timestamp:
Jan 27, 2017, 2:22:06 PM (3 years ago)
Author:
nmedfort
Message:

Optimized Symbol Generation (and fixed potential bug that could allow duplicate names being constructed); made PabloKernel? extend PabloAST (temporarily removed PabloAST::getName() to avoid diamond problem); added an internal scalar to PabloKernel? struct for each Count to avoid InOut? output scalar variable problem; allowed CodeMotionPass? to move code within the same scope but across a branch statement. Began work on separating Kernels into either Block-Oriented or Segment-Oriented kernels.

File:
1 edited

Legend:

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

    r5267 r5283  
    1919    friend class Statement;
    2020public:
     21
     22    enum Attribute {
     23        None = 0
     24        , ReadOnly = 1
     25        , ReadNone = 2
     26    };
     27
    2128    static inline bool classof(const PabloAST * e) {
    2229        return e->getClassTypeId() == ClassTypeId::Var;
     
    2633    }
    2734    bool isReadOnly() const {
    28         return mReadOnly;
     35        return mAttribute & Attribute::ReadOnly;
    2936    }
    3037    void setReadOnly(const bool value = true) {
    31         mReadOnly = value;
     38        if (value) {
     39            mAttribute |= Attribute::ReadOnly;
     40        } else {
     41            mAttribute &= ~(Attribute::ReadOnly);
     42        }
    3243    }
     44    bool isReadNone() const {
     45        return mAttribute & Attribute::ReadNone;
     46    }
     47    void setReadNone(const bool value = true) {
     48        if (value) {
     49            mAttribute |= Attribute::ReadNone;
     50        } else {
     51            mAttribute &= ~(Attribute::ReadNone);
     52        }
     53    }
     54
     55    const String & getName() const noexcept {
     56        return *mName;
     57    }
     58
    3359protected:
    34     Var(const PabloAST * name, llvm::Type * const type, Allocator & allocator, const bool readOnly = false)
    35     : PabloAST(ClassTypeId::Var, type, llvm::cast<String>(name), allocator)
    36     , mReadOnly(readOnly) {
     60    Var(const String * name, llvm::Type * const type, Allocator & allocator, const Attribute attr = Attribute::None)
     61    : PabloAST(ClassTypeId::Var, type, allocator)
     62    , mAttribute(attr)
     63    , mName(name) {
    3764
    3865    }
    3966private:
    40     bool mReadOnly;
     67    unsigned mAttribute;
     68    const String * const mName;
    4169};
    4270
Note: See TracChangeset for help on using the changeset viewer.