Ignore:
Timestamp:
May 31, 2017, 4:25:33 PM (2 years ago)
Author:
nmedfort
Message:

Initial attempt to improve debugging capabilities with compilation stack traces on error.

File:
1 edited

Legend:

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

    r5371 r5486  
    3434
    3535    using Allocator = SlabAllocator<PabloAST *>;
    36     using UserAllocator = ProxyAllocator<PabloAST *>;
    37     using Users = std::vector<PabloAST *, UserAllocator>;
     36    using Users = std::vector<PabloAST *, ProxyAllocator<PabloAST *>>;
    3837    using user_iterator = Users::iterator;
    3938    using const_user_iterator = Users::const_iterator;
     
    155154    }
    156155    bool addUser(PabloAST * const user);
     156
    157157    bool removeUser(PabloAST * const user);
    158     virtual ~PabloAST() {
    159         mUsers.clear();
    160     }       
     158
     159    virtual ~PabloAST() = default;
     160
    161161private:
    162162    const ClassTypeId       mClassTypeId;
     
    226226        return mParent;
    227227    }
    228     virtual ~Statement() {}
     228    virtual ~Statement() = default;
     229
    229230protected:
    230231
     
    283284};
    284285
     286class CarryProducingStatement : public Statement {
     287public:
     288
     289    static inline bool classof(const PabloAST * e) {
     290        switch (e->getClassTypeId()) {
     291            case PabloAST::ClassTypeId::Advance:
     292            case PabloAST::ClassTypeId::ScanThru:
     293            case PabloAST::ClassTypeId::AdvanceThenScanThru:
     294            case PabloAST::ClassTypeId::ScanTo:
     295            case PabloAST::ClassTypeId::AdvanceThenScanTo:
     296            case PabloAST::ClassTypeId::MatchStar:
     297                return true;
     298            default: return false;
     299        }
     300    }
     301    static inline bool classof(const CarryProducingStatement *) {
     302        return true;
     303    }
     304    static inline bool classof(const void *) {
     305        return false;
     306    }
     307
     308    unsigned getCarryGroup() const {
     309        return mCarryGroup;
     310    }
     311
     312    void setCarryGroup(const unsigned carryGroup) {
     313        mCarryGroup = carryGroup;
     314    }
     315
     316    virtual ~CarryProducingStatement() = default;
     317
     318protected:
     319
     320    explicit CarryProducingStatement(const ClassTypeId id, llvm::Type * const type, std::initializer_list<PabloAST *> operands, const String * const name, Allocator & allocator)
     321    : Statement(id, type, operands, name, allocator)
     322    , mCarryGroup(0) {
     323
     324    }
     325
     326    explicit CarryProducingStatement(const ClassTypeId id, llvm::Type * const type, const unsigned reserved, const String * name, Allocator & allocator)
     327    : Statement(id, type, reserved, name, allocator)
     328    , mCarryGroup(0) {
     329
     330    }
     331
     332    template<typename iterator>
     333    explicit CarryProducingStatement(const ClassTypeId id, llvm::Type * const type, iterator begin, iterator end, const String * name, Allocator & allocator)
     334    : Statement(id, type, begin, end, name, allocator)
     335    , mCarryGroup(0) {
     336
     337    }
     338
     339private:
     340
     341    unsigned mCarryGroup;
     342};
     343
     344
    285345class Variadic : public Statement {
    286346public:
     
    343403        return iterator(mOperand + mOperands);
    344404    }
     405
     406    virtual ~Variadic() = default;
    345407
    346408protected:
Note: See TracChangeset for help on using the changeset viewer.