Ignore:
Timestamp:
Dec 31, 2014, 9:47:37 AM (4 years ago)
Author:
cameron
Message:

Incremental step towards general property support

File:
1 edited

Legend:

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

    r4376 r4378  
    5858#include <llvm/IR/IRBuilder.h>
    5959
    60 //#define DUMP_GENERATED_IR
    6160#include "llvm/Support/CommandLine.h"
    62 static cl::opt<bool> DumpGeneratedIR("dump-generated-IR", cl::init(false), cl::desc("print LLVM IR generated by RE compilation"));
     61
     62#include "unicode_categories.h"
     63
     64cl::OptionCategory eIRDumpOptions("LLVM IR Dump Options", "These options control dumping of LLVM IR.");
     65static cl::opt<bool> DumpGeneratedIR("dump-generated-IR", cl::init(false), cl::desc("print LLVM IR generated by RE compilation"), cl::cat(eIRDumpOptions));
    6366
    6467extern "C" {
     
    6770  }
    6871}
    69 
    70 #define CREATE_GENERAL_CODE_CATEGORY(SUFFIX) \
    71 SUFFIX * f##SUFFIX = nullptr; \
    72 extern "C" { \
    73     BitBlock __get_category_##SUFFIX(Basis_bits &basis_bits) { \
    74         if (f##SUFFIX == nullptr) f##SUFFIX = new SUFFIX(); \
    75         Struct_##SUFFIX output; \
    76         f##SUFFIX->do_block(basis_bits, output); \
    77         return output.cc; \
    78     } \
    79 }
    80 
    81 CREATE_GENERAL_CODE_CATEGORY(Cc)
    82 CREATE_GENERAL_CODE_CATEGORY(Cf)
    83 CREATE_GENERAL_CODE_CATEGORY(Cn)
    84 CREATE_GENERAL_CODE_CATEGORY(Co)
    85 CREATE_GENERAL_CODE_CATEGORY(Cs)
    86 CREATE_GENERAL_CODE_CATEGORY(Ll)
    87 CREATE_GENERAL_CODE_CATEGORY(Lm)
    88 CREATE_GENERAL_CODE_CATEGORY(Lo)
    89 CREATE_GENERAL_CODE_CATEGORY(Lt)
    90 CREATE_GENERAL_CODE_CATEGORY(Lu)
    91 CREATE_GENERAL_CODE_CATEGORY(Mc)
    92 CREATE_GENERAL_CODE_CATEGORY(Me)
    93 CREATE_GENERAL_CODE_CATEGORY(Mn)
    94 CREATE_GENERAL_CODE_CATEGORY(Nd)
    95 CREATE_GENERAL_CODE_CATEGORY(Nl)
    96 CREATE_GENERAL_CODE_CATEGORY(No)
    97 CREATE_GENERAL_CODE_CATEGORY(Pc)
    98 CREATE_GENERAL_CODE_CATEGORY(Pd)
    99 CREATE_GENERAL_CODE_CATEGORY(Pe)
    100 CREATE_GENERAL_CODE_CATEGORY(Pf)
    101 CREATE_GENERAL_CODE_CATEGORY(Pi)
    102 CREATE_GENERAL_CODE_CATEGORY(Po)
    103 CREATE_GENERAL_CODE_CATEGORY(Ps)
    104 CREATE_GENERAL_CODE_CATEGORY(Sc)
    105 CREATE_GENERAL_CODE_CATEGORY(Sk)
    106 CREATE_GENERAL_CODE_CATEGORY(Sm)
    107 CREATE_GENERAL_CODE_CATEGORY(So)
    108 CREATE_GENERAL_CODE_CATEGORY(Zl)
    109 CREATE_GENERAL_CODE_CATEGORY(Zp)
    110 CREATE_GENERAL_CODE_CATEGORY(Zs)
    111 
    112 #undef CREATE_GENERAL_CODE_CATEGORY
    11372
    11473namespace pablo {
     
    147106{
    148107    delete mMod;
    149     delete fPs;
    150     delete fNl;
    151     delete fNo;
    152     delete fLo;
    153     delete fLl;
    154     delete fLm;
    155     delete fNd;
    156     delete fPc;
    157     delete fLt;
    158     delete fLu;
    159     delete fPf;
    160     delete fPd;
    161     delete fPe;
    162     delete fPi;
    163     delete fPo;
    164     delete fMe;
    165     delete fMc;
    166     delete fMn;
    167     delete fSk;
    168     delete fSo;
    169     delete fSm;
    170     delete fSc;
    171     delete fZl;
    172     delete fCo;
    173     delete fCn;
    174     delete fCc;
    175     delete fCf;
    176     delete fCs;
    177     delete fZp;
    178     delete fZs;
    179108}
    180109
     
    541470        #define CHECK_GENERAL_CODE_CATEGORY(SUFFIX) \
    542471            if (callee->str() == #SUFFIX) { \
    543                 callee_ptr = (void*)&__get_category_##SUFFIX; \
     472                callee_ptr = (void*)&__get_gc_##SUFFIX; \
    544473            } else
    545474        CHECK_GENERAL_CODE_CATEGORY(Cc)
     
    576505        throw std::runtime_error("Unknown unicode category \"" + callee->str() + "\"");
    577506        #undef CHECK_GENERAL_CODE_CATEGORY
    578         Value * unicodeCategory = mMod->getOrInsertFunction("__get_category_" + callee->str(), mBitBlockType, mBasisBitsInputPtr, NULL);
     507        Value * unicodeCategory = mMod->getOrInsertFunction("__get_gc_" + callee->str(), mBitBlockType, mBasisBitsInputPtr, NULL);
    579508        if (LLVM_UNLIKELY(unicodeCategory == nullptr)) {
    580509            throw std::runtime_error("Could not create static method call for unicode category \"" + callee->str() + "\"");
Note: See TracChangeset for help on using the changeset viewer.