Changeset 4667 for icGREP/icgrep-devel


Ignore:
Timestamp:
Jul 14, 2015, 12:20:32 AM (4 years ago)
Author:
nmedfort
Message:

Force UnsupportedPropertyObject? kind to be UnsupportedProperty?.

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

Legend:

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

    r4661 r4667  
    9898}
    9999
    100 UnicodeSet BinaryPropertyObject::GetCodepointSet(const std::string & value_spec) const {
     100const UnicodeSet & BinaryPropertyObject::GetCodepointSet(const std::string & value_spec) {
     101    int property_enum_val = Binary_ns::Y;
    101102    if (value_spec.length() != 0) {
    102103        auto valit = Binary_ns::aliases_only_map.find(value_spec);
     
    104105            throw std::runtime_error("Binary Property " + UCD::property_full_name[the_property] +  ": bad value: " + value_spec);
    105106        }
    106         if (valit->second == Binary_ns::Y)
    107             return the_codepoint_set;
    108         return ~the_codepoint_set;
     107        property_enum_val = valit->second;
    109108    }
    110     return the_codepoint_set;
     109    return GetCodepointSet(property_enum_val);
    111110}
    112111
    113 UnicodeSet BinaryPropertyObject::GetCodepointSet(const int property_enum_val) const {
    114     if (property_enum_val == Binary_ns::Y)
    115         return the_codepoint_set;
    116     return ~the_codepoint_set;
     112const UnicodeSet & BinaryPropertyObject::GetCodepointSet(const int property_enum_val) {
     113    if (property_enum_val == Binary_ns::Y) {
     114        return mY;
     115    }
     116    if (noUninitialized) {
     117        mN = uset_complement(mY);
     118    }
     119    return mN;
    117120}
    118121
  • icGREP/icgrep-devel/icgrep/UCD/PropertyObjects.h

    r4661 r4667  
    5454    }
    5555
    56     UnsupportedPropertyObject(property_t p, ClassTypeId k) : PropertyObject(p, k) {}
     56    UnsupportedPropertyObject(property_t p, ClassTypeId)
     57    : PropertyObject(p, ClassTypeId::UnsupportedProperty) {
     58
     59    }
    5760    UnicodeSet GetCodepointSet(const std::string &);
    5861    UnicodeSet GetCodepointSet(const int);
     
    144147
    145148    BinaryPropertyObject(UCD::property_t p, UnicodeSet s)
    146         : PropertyObject(p, ClassTypeId::BinaryProperty)
    147         , the_codepoint_set(s) {
     149    : PropertyObject(p, ClassTypeId::BinaryProperty)
     150    , noUninitialized(true)
     151    , mY(s) {
    148152
    149153    }
    150     UnicodeSet GetCodepointSet(const std::string & value_spec) const;
    151     UnicodeSet GetCodepointSet(const int property_enum_val) const;
     154    const UnicodeSet & GetCodepointSet(const std::string & value_spec);
     155    const UnicodeSet & GetCodepointSet(const int property_enum_val);
    152156private:
    153     UnicodeSet the_codepoint_set;
     157    bool noUninitialized;
     158    UnicodeSet mY;
     159    UnicodeSet mN;
    154160};
    155161
  • icGREP/icgrep-devel/icgrep/generate_predefined_ucd_functions.cpp

    r4666 r4667  
    3535#include "llvm/Support/FileSystem.h"
    3636#include <llvm/Transforms/Scalar.h>
    37 
    38 
    3937#include <boost/algorithm/string/case_conv.hpp>
    4038#include <iostream>
     
    5250static cl::opt<std::string>
    5351OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
     52
     53#ifdef ENABLE_MULTIPLEXING
     54static cl::opt<bool> EnableMultiplexing("multiplexing", cl::init(false),
     55                                        cl::desc("combine Advances whose inputs are mutual exclusive into the fewest number of advances possible (expensive)."));
     56#endif
    5457
    5558/** ------------------------------------------------------------------------------------------------------------- *
     
    6265    UCDCompiler ucdCompiler(ccCompiler);
    6366    PabloBuilder builder(function.getEntryBlock());
     67
     68    std::cerr << "Compiling " << name << std::endl;
     69
    6470    // Build the unicode set function
    6571    ucdCompiler.generateWithDefaultIfHierarchy(set, builder);
     
    6874    CodeSinking::optimize(function);
    6975    #ifdef ENABLE_MULTIPLEXING
    70     AutoMultiplexing::optimize(function);
     76    if (EnableMultiplexing) {
     77        AutoMultiplexing::optimize(function);
     78    }
    7179    #endif
    7280    // Now compile the function ...
     
    8391    for (PropertyObject * obj : property_object_table) {
    8492
    85         if (isa<UnsupportedPropertyObject>(obj)) continue;
    86 
    87         if (auto * enumObj = dyn_cast<EnumeratedPropertyObject>(obj)) {
     93        if (EnumeratedPropertyObject * enumObj = dyn_cast<EnumeratedPropertyObject>(obj)) {
    8894            for (const std::string value : *enumObj) {
    8995                const UnicodeSet & set = enumObj->GetCodepointSet(canonicalize_value_name(value));
    90                 std::string name = "__get_" + property_enum_name[enumObj->getPropertyCode()] + "_" + lowercase(value);
    91                 compileUnicodeSet(name, set, pc, module);
    92             }
    93             break;
    94         }
    95         else if (auto * extObj = dyn_cast<ExtensionPropertyObject>(obj)) {
    96             for (const std::string value : *extObj) {
    97                 const UnicodeSet & set = extObj->GetCodepointSet(canonicalize_value_name(value));
    98                 std::string name = "__get_" + property_enum_name[extObj->getPropertyCode()] + "_" + lowercase(value);
     96                std::string name = "__get_" + property_enum_name[enumObj->getPropertyCode()] + "_" + value;
    9997                compileUnicodeSet(name, set, pc, module);
    10098            }
    10199        }
    102         else if (auto * binObj = dyn_cast<BinaryPropertyObject>(obj)) {
     100        else if (ExtensionPropertyObject * extObj = dyn_cast<ExtensionPropertyObject>(obj)) {
     101            for (const std::string value : *extObj) {
     102                const UnicodeSet & set = extObj->GetCodepointSet(canonicalize_value_name(value));
     103                std::string name = "__get_" + property_enum_name[extObj->getPropertyCode()] + "_" + value;
     104                compileUnicodeSet(name, set, pc, module);
     105            }
     106        }
     107        else if (BinaryPropertyObject * binObj = dyn_cast<BinaryPropertyObject>(obj)) {
    103108            const UnicodeSet & set = binObj->GetCodepointSet(Binary_ns::Y);
    104             std::string name = "__get_" + property_enum_name[binObj->getPropertyCode()] + "_y";
     109            std::string name = "__get_" + property_enum_name[binObj->getPropertyCode()] + "_Y";
    105110            compileUnicodeSet(name, set, pc, module);
    106111        }
     112
    107113    }
    108114
Note: See TracChangeset for help on using the changeset viewer.