Ignore:
Timestamp:
Jan 15, 2018, 4:07:07 PM (19 months ago)
Author:
nmedfort
Message:

Removed Variadic functionality; allowed for deferred creation of statement names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r5828 r5834  
    4949///
    5050
    51 Count * PabloBlock::createCount(PabloAST * expr) {
     51Count * PabloBlock::createCount(PabloAST * const expr) {
    5252    IntegerType * const type = getParent()->getSizeTy();
    5353    return insertAtInsertionPoint(new (mAllocator) Count(expr, makeName("count"), type, mAllocator));
     
    6161Not * PabloBlock::createNot(PabloAST * expr, String * name) {
    6262    assert (expr);
    63     if (name == nullptr) {
    64         name = makeName("not");
    65     }
    6663    return insertAtInsertionPoint(new (mAllocator) Not(expr, name, mAllocator));
    6764}
    6865
    69 Var * PabloBlock::createVar(PabloAST * name, Type * type) {
     66Var * PabloBlock::createVar(String * name, Type * type) {
    7067    if (type == nullptr) {
    7168        type = getParent()->getStreamTy();
    7269    }
    73     if (LLVM_UNLIKELY(name == nullptr || !isa<String>(name))) {
     70    if (LLVM_UNLIKELY(name == nullptr)) {
    7471        throw std::runtime_error("Var objects must have a String name");
    7572    }
     
    7976InFile * PabloBlock::createInFile(PabloAST * expr, String * name) {
    8077    assert (expr);
    81     if (name == nullptr) {
    82         name = makeName("inFile");
    83     }
    8478    return insertAtInsertionPoint(new (mAllocator) InFile(expr, name, mAllocator));
    8579}
     
    8781AtEOF * PabloBlock::createAtEOF(PabloAST * expr, String * name) {
    8882    assert (expr);
    89     if (name == nullptr) {
    90         name = makeName("atEOF");
    91     }
    9283    return insertAtInsertionPoint(new (mAllocator) AtEOF(expr, name, mAllocator));
    9384}
     
    9687
    9788Advance * PabloBlock::createAdvance(PabloAST * expr, Integer * shiftAmount, String * name) {
    98     if (name == nullptr) {
    99         name = makeName("advance");
    100     }
    10189    return insertAtInsertionPoint(new (mAllocator) Advance(expr, shiftAmount, name, mAllocator));
    10290}
    10391
    10492Lookahead * PabloBlock::createLookahead(PabloAST * expr, Integer * shiftAmount, String * name) {
    105     if (name == nullptr) {
    106         name = makeName("lookahead");
    107     }
    10893    return insertAtInsertionPoint(new (mAllocator) Lookahead(expr, shiftAmount, name, mAllocator));
    10994}
     
    129114And * PabloBlock::createAnd(PabloAST * expr1, PabloAST * expr2, String * name) {
    130115    CHECK_SAME_TYPE(expr1, expr2);
    131     if (name == nullptr) {
    132         name = makeName("and");
    133     }
    134116    return insertAtInsertionPoint(new (mAllocator) And(expr1->getType(), expr1, expr2, name, mAllocator));
    135117}
    136118
    137 And * PabloBlock::createAnd(Type * const type, const unsigned reserved, String * name) {
    138     if (name == nullptr) {
    139         name = makeName("and");
    140     }
    141     return insertAtInsertionPoint(new (mAllocator) And(type, reserved, name, mAllocator));
    142 }
    143 
    144119Or * PabloBlock::createOr(PabloAST * expr1, PabloAST * expr2, String * name) {
    145120    CHECK_SAME_TYPE(expr1, expr2);
    146     if (name == nullptr) {
    147         name = makeName("or");
    148     }
    149121    return insertAtInsertionPoint(new (mAllocator) Or(expr1->getType(), expr1, expr2, name, mAllocator));
    150122}
    151123
    152 Or * PabloBlock::createOr(Type * const type, const unsigned reserved, String * name) {
    153     if (name == nullptr) {
    154         name = makeName("or");
    155     }
    156     return insertAtInsertionPoint(new (mAllocator) Or(type, reserved, name, mAllocator));
    157 }
    158 
    159124Xor * PabloBlock::createXor(PabloAST * expr1, PabloAST * expr2, String * name) {
    160125    CHECK_SAME_TYPE(expr1, expr2);
    161     if (name == nullptr) {
    162         name = makeName("xor");
    163     }
    164126    return insertAtInsertionPoint(new (mAllocator) Xor(expr1->getType(), expr1, expr2, name, mAllocator));
    165 }
    166 
    167 Xor * PabloBlock::createXor(Type * const type, const unsigned reserved, String * name) {
    168     if (name == nullptr) {
    169         name = makeName("xor");
    170     }
    171     return insertAtInsertionPoint(new (mAllocator) Xor(type, reserved, name, mAllocator));
    172127}
    173128
     
    233188MatchStar * PabloBlock::createMatchStar(PabloAST * marker, PabloAST * charclass, String * name) {
    234189    CHECK_SAME_TYPE(marker, charclass);
    235     if (name == nullptr) {
    236         name = makeName("matchstar");
    237     }
    238190    return insertAtInsertionPoint(new (mAllocator) MatchStar(marker, charclass, name, mAllocator));
    239191}
     
    241193ScanThru * PabloBlock::createScanThru(PabloAST * from, PabloAST * thru, String * name) {
    242194    CHECK_SAME_TYPE(from, thru);
    243     if (name == nullptr) {
    244         name = makeName("scanthru");
    245     }
    246195    return insertAtInsertionPoint(new (mAllocator) ScanThru(from, thru, name, mAllocator));
    247196}
     
    249198ScanTo * PabloBlock::createScanTo(PabloAST * from, PabloAST * to, String * name) {
    250199    CHECK_SAME_TYPE(from, to);
    251     if (name == nullptr) {
    252         name = makeName("scanto");
    253     }
    254200    return insertAtInsertionPoint(new (mAllocator) ScanTo(from, to, name, mAllocator));
    255201}
     
    257203AdvanceThenScanThru * PabloBlock::createAdvanceThenScanThru(PabloAST * from, PabloAST * thru, String * name) {
    258204    CHECK_SAME_TYPE(from, thru);
    259     if (name == nullptr) {
    260         name = makeName("advscanthru");
    261     }
    262205    return insertAtInsertionPoint(new (mAllocator) AdvanceThenScanThru(from, thru, name, mAllocator));
    263206}
     
    265208AdvanceThenScanTo * PabloBlock::createAdvanceThenScanTo(PabloAST * from, PabloAST * to, String * name) {
    266209    CHECK_SAME_TYPE(from, to);
    267     if (name == nullptr) {
    268         name = makeName("advscanto");
    269     }
    270210    return insertAtInsertionPoint(new (mAllocator) AdvanceThenScanTo(from, to, name, mAllocator));
    271211}
     
    287227Repeat * PabloBlock::createRepeat(Integer * fieldWidth, PabloAST * value, String * name) {
    288228    assert (fieldWidth && value);
    289     if (name == nullptr) {
    290         name = makeName("fill");
    291     }
    292229    Type * const type = VectorType::get(IntegerType::get(value->getType()->getContext(), fieldWidth->value()), 0);
    293230    return insertAtInsertionPoint(new (mAllocator) Repeat(fieldWidth, value, type, name, mAllocator));
     
    296233PackH * PabloBlock::createPackH(Integer * fieldWidth, PabloAST * value, String * name) {
    297234    assert (fieldWidth && value);
    298     if (name == nullptr) {
    299         name = makeName("packh");
    300     }
    301235    Type * const type = VectorType::get(IntegerType::get(value->getType()->getContext(), fieldWidth->value()), 0);
    302236    return insertAtInsertionPoint(new (mAllocator) PackH(fieldWidth, value, name, type, mAllocator));
     
    305239PackL * PabloBlock::createPackL(Integer * fieldWidth, PabloAST * value, String * name) {
    306240    assert (fieldWidth && value);
    307     if (name == nullptr) {
    308         name = makeName("packl");
    309     }
    310241    Type * const type = VectorType::get(IntegerType::get(value->getType()->getContext(), fieldWidth->value()), 0);
    311242    return insertAtInsertionPoint(new (mAllocator) PackL(fieldWidth, value, name, type, mAllocator));
     
    316247Sel * PabloBlock::createSel(PabloAST * condition, PabloAST * trueExpr, PabloAST * falseExpr, String * name) {
    317248    CHECK_SAME_TYPE(trueExpr, falseExpr);
    318     if (name == nullptr) {
    319         name = makeName("sel");
    320     }
    321249    return insertAtInsertionPoint(new (mAllocator) Sel(condition, trueExpr, falseExpr, name, mAllocator));
    322250}
    323251
    324252IndexedAdvance * PabloBlock::createIndexedAdvance(PabloAST * expr, PabloAST * indexStream, Integer * shiftAmount, String * name) {
    325     if (name == nullptr) {
    326         name = makeName("indexed_advance");
    327     }
    328253    return insertAtInsertionPoint(new (mAllocator) IndexedAdvance(expr, indexStream, shiftAmount, name, mAllocator));
    329254}
Note: See TracChangeset for help on using the changeset viewer.