Ignore:
Timestamp:
Sep 30, 2015, 12:26:23 PM (4 years ago)
Author:
nmedfort
Message:

Progress on multi-target UCD compilation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/UCD/ucd_compiler.cpp

    r4804 r4808  
    99
    1010namespace UCD {
    11 
    12 /** ------------------------------------------------------------------------------------------------------------- *
    13  * @brief addTarget
    14  ** ------------------------------------------------------------------------------------------------------------- */
    15 inline void UCDCompiler::addTarget(const UnicodeSet & set) {
    16     mTargetMap.emplace(&set, PabloBlock::createZeroes());
    17 }
    1811
    1912/** ------------------------------------------------------------------------------------------------------------- *
     
    369362 * @return the output stream with a 1-bit in any position of a character in the unicode set
    370363 ** ------------------------------------------------------------------------------------------------------------- */
    371 PabloAST * UCDCompiler::generateWithDefaultIfHierarchy(const UnicodeSet & set, PabloBuilder & entry) {
     364std::vector<PabloAST *> UCDCompiler::generateWithDefaultIfHierarchy(const std::vector<UnicodeSet> & sets, PabloBuilder & entry) {
    372365
    373366    const RangeList defaultIfHierachy = {
     
    458451        {0x10000, 0x10FFFF}};
    459452
    460     addTarget(set);
     453    addTargets(sets);
    461454    generateRange(defaultIfHierachy, entry);
    462     return mTargetMap[&set];
     455    return std::move(returnMarkers(sets));
    463456}
    464457
     
    469462 * @return the output stream with a 1-bit in any position of a character in the unicode set
    470463 ** ------------------------------------------------------------------------------------------------------------- */
    471 PabloAST * UCDCompiler::generateWithoutIfHierarchy(const UnicodeSet & set, PabloBuilder & entry) {
    472     const RangeList defaultIfHierachy = {{0x10000, 0x10FFFF}};
    473     addTarget(set);
    474     generateRange(defaultIfHierachy, entry);
    475     return mTargetMap[&set];
     464std::vector<PabloAST *> UCDCompiler::generateWithoutIfHierarchy(const std::vector<UnicodeSet> & sets, PabloBuilder & entry) {
     465    const RangeList noIfHierachy = {{0x10000, 0x10FFFF}};
     466
     467    addTargets(sets);
     468    generateRange(noIfHierachy, entry);
     469    return std::move(returnMarkers(sets));
     470}
     471
     472/** ------------------------------------------------------------------------------------------------------------- *
     473 * @brief addTargets
     474 ** ------------------------------------------------------------------------------------------------------------- */
     475inline void UCDCompiler::addTargets(const std::vector<UnicodeSet> &sets) {
     476    for (const UnicodeSet & set : sets) {
     477        mTargetMap.emplace(&set, PabloBlock::createZeroes());
     478    }
     479}
     480
     481/** ------------------------------------------------------------------------------------------------------------- *
     482 * @brief returnMarkers
     483 ** ------------------------------------------------------------------------------------------------------------- */
     484inline std::vector<PabloAST *> UCDCompiler::returnMarkers(const std::vector<UnicodeSet> & sets) const {
     485    std::vector<PabloAST *> markers(sets.size());
     486    unsigned i = 0;
     487    for (const UnicodeSet & set : sets) {
     488        auto f = mTargetMap.find(&set);
     489        assert (f != mTargetMap.end());
     490        assert (f->second);
     491        markers[i++] = f->second;
     492    }
     493    return std::move(markers);
    476494}
    477495
Note: See TracChangeset for help on using the changeset viewer.