Ignore:
Timestamp:
Sep 9, 2018, 10:09:53 AM (7 months ago)
Author:
cameron
Message:

Optimization of intersect/diff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_name.h

    r5887 r6159  
    183183}
    184184
     185template <typename To, typename FromTy> bool defined(FromTy * e) {
     186    if (llvm::isa<To>(e)) return true;
     187    if (llvm::isa<re::Name>(e)) {
     188        re::RE * def = llvm::cast<re::Name>(e)->getDefinition();
     189        return def && defined<To, FromTy>(def);
     190    }
     191    return false;
     192}
     193
     194template <typename To, typename FromTy> To * defCast(FromTy * e) {
     195    if (llvm::isa<To>(e)) return llvm::cast<To>(e);
     196    if (llvm::isa<re::Name>(e)) {
     197        re::RE * def = llvm::cast<re::Name>(e)->getDefinition();
     198        if (def) return defCast<To, FromTy>(def);
     199    }
     200    return nullptr;
     201}
     202
     203
    185204#endif // RE_NAME_H
Note: See TracChangeset for help on using the changeset viewer.