Changeset 4437


Ignore:
Timestamp:
Jan 23, 2015, 11:04:43 AM (4 years ago)
Author:
nmedfort
Message:

Couple minor bug fixes.

Location:
icGREP/icgrep-devel/icgrep
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r4432 r4437  
    7474    }
    7575    else if (Name * name = dyn_cast<Name>(re)) {
    76         RE * d = name->getDefinition();
    77         if (d && !isa<CC>(d)) {
    78             compileByteClasses(d);
    79         }
    80         else if (d && isa<CC>(d)) {
    81             name->setCompiled(compileCC(cast<CC>(d), mCG));
    82         }
     76        RE * def = name->getDefinition();
     77        if (LLVM_LIKELY(def != nullptr)) {
     78            if (!isa<CC>(def)) {
     79                compileByteClasses(def);
     80            }
     81            else if (name->getCompiled() == nullptr) {
     82                name->setCompiled(compileCC(cast<CC>(def), mCG));
     83            }
     84        }
    8385    }
    8486    else if (isa<CC>(re)) {
    85         throw std::runtime_error("icgrep internal error: unexpected CC object found in compileByteClasses.");
     87        throw std::runtime_error("icgrep internal error: unexpected CC object \"" + Printer_RE::PrintRE(re) + "\" found in compileByteClasses.");
    8688    }
    8789}
     
    150152            if ((pattern & test_bit) == 0)
    151153            {
    152                 bit_terms.push_back(mCG.createNot(getBasisVar(i)));
     154                bit_terms.push_back(pb.createNot(getBasisVar(i)));
    153155            }
    154156            else
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r4433 r4437  
    5050Var * PabloBlock::createVar(String * name) {
    5151    assert (name);
    52     return insertAtInsertionPoint(new Var(name, this));
     52    return new Var(name, this);
    5353}
    5454
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4420 r4437  
    111111
    112112#ifdef USE_IF_FOR_NONFINAL
    113     PabloAST * u8single = ccc.compileCC(makeCC(0x00, 0x7F));
    114113    PabloAST * u8pfx = ccc.compileCC(makeCC(0xC0, 0xFF));
    115114    PabloBlock & it = PabloBlock::Create(mCG);
     
    121120    PabloAST * u8scope42 = it.createAssign("u8scope42", it.createAdvance(u8pfx4, 1));
    122121    PabloAST * u8scope43 = it.createAdvance(u8scope42, 1);
    123     Assign * a_nonfinal = it.createAssign(nonfinal, it.createOr(it.createOr(u8pfx, u8scope32), it.createOr(u8scope42, u8scope43)));
     122    mNonFinal = it.createAssign(nonfinal, it.createOr(it.createOr(u8pfx, u8scope32), it.createOr(u8scope42, u8scope43)));
    124123    PabloAST * NEL = it.createAnd(it.createAdvance(ccc.compileCC(makeCC(0xC2), it), 1), ccc.compileCC(makeCC(0x85), it));
    125124    PabloAST * E2_80 = it.createAnd(it.createAdvance(ccc.compileCC(makeCC(0xE2), it), 1), ccc.compileCC(makeCC(0x80), it));
    126125    PabloAST * LS_PS = it.createAnd(it.createAdvance(E2_80, 1), ccc.compileCC(makeCC(0xA8,0xA9), it));
    127126    Assign * NEL_LS_PS = it.createAssign("NEL_LS_PS", it.createOr(NEL, LS_PS));
    128     mCG.createIf(u8pfx, std::move(std::vector<Assign *>{valid_pfx, a_nonfinal, NEL_LS_PS}), it);
     127    mCG.createIf(u8pfx, std::move(std::vector<Assign *>{valid_pfx, mNonFinal, NEL_LS_PS}), it);
    129128    PabloAST * LB_chars = mCG.createOr(LF_VT_FF_CR, NEL_LS_PS);
     129
     130    PabloAST * u8single = ccc.compileCC(makeCC(0x00, 0x7F));
    130131    mInitial = mCG.createAssign(initial, mCG.createOr(u8single, valid_pfx));
    131     mNonFinal = a_nonfinal;
    132132    mUnicodeLineBreak = mCG.createAnd(LB_chars, mCG.createNot(mCRLF));  // count the CR, but not CRLF
    133133    #endif
     
    157157            assert(markerPos(m) == FinalMatchByte);
    158158            Assign * v = markerVar(m);
    159             name->setCompiled(markerVar(m));
     159            name->setCompiled(v);
    160160            return v;
    161161        }
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r4420 r4437  
    9292    pablo::PabloAST *                               mCRLF;
    9393    pablo::PabloAST *                               mUnicodeLineBreak;
    94     pablo::PabloAST *                               mInitial;
    95     pablo::PabloAST *                               mNonFinal;   
     94    pablo::Assign *                                 mInitial;
     95    pablo::Assign *                                 mNonFinal;
    9696};
    9797
Note: See TracChangeset for help on using the changeset viewer.