Ignore:
Timestamp:
Jun 12, 2015, 2:16:59 PM (4 years ago)
Author:
nmedfort
Message:

Fixed PabloBuilder? and intergrated it into CC Compiler.

File:
1 edited

Legend:

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

    r4511 r4602  
    99
    1010//Pablo Expressions
    11 #include <pablo/codegenstate.h>
    1211#include <re/re_alt.h>
    1312#include <re/re_cc.h>
     
    1918#include <re/re_assertion.h>
    2019#include <cc/cc_namemap.hpp>
     20#include <pablo/codegenstate.h>
     21#include <pablo/builder.hpp>
    2122#include <stdexcept>
    2223
     
    3637}
    3738
    38 pablo::Assign * CC_Compiler::compileCC(const re::CC *cc) {
    39      return compileCC(cc, mCG);
    40 }
    41 
    42 pablo::Assign * CC_Compiler::compileCC(const re::CC *cc, pablo::PabloBlock & pb) {
    43      return pb.createAssign(cc->canonicalName(ByteClass), charset_expr(cc, pb));
     39Assign * CC_Compiler::compileCC(const CC *cc) {
     40    return compileCC(cc, mCG);
     41}
     42
     43Assign * CC_Compiler::compileCC(const CC *cc, PabloBlock & block) {
     44    PabloBuilder pb(block);
     45    return compileCC(cc, pb);
     46}
     47
     48Assign * CC_Compiler::compileCC(const CC *cc, PabloBuilder & pb) {
     49    return pb.createAssign(cc->canonicalName(ByteClass), charset_expr(cc, pb));
    4450}
    4551
     
    9197
    9298
    93 PabloAST * CC_Compiler::charset_expr(const CC * cc, pablo::PabloBlock & pb) {
     99PabloAST * CC_Compiler::charset_expr(const CC * cc, PabloBuilder & pb) {
    94100    if (cc->empty()) {
    95101        return pb.createZeroes();
     
    136142}
    137143
    138 PabloAST * CC_Compiler::bit_pattern_expr(const unsigned pattern, unsigned selected_bits, pablo::PabloBlock & pb)
     144PabloAST * CC_Compiler::bit_pattern_expr(const unsigned pattern, unsigned selected_bits, PabloBuilder &pb)
    139145{
    140146    if (selected_bits == 0) {
     
    186192}
    187193
    188 inline PabloAST * CC_Compiler::char_test_expr(const CodePointType ch, pablo::PabloBlock & pb)
    189 {
     194inline PabloAST * CC_Compiler::char_test_expr(const CodePointType ch, PabloBuilder &pb) {
    190195    return bit_pattern_expr(ch, mEncoding.getMask(), pb);
    191196}
    192197
    193 PabloAST * CC_Compiler::make_range(const CodePointType n1, const CodePointType n2, pablo::PabloBlock & pb)
    194 {
     198PabloAST * CC_Compiler::make_range(const CodePointType n1, const CodePointType n2, PabloBuilder & pb) {
    195199    CodePointType diff_count = 0;
    196200
     
    216220}
    217221
    218 PabloAST * CC_Compiler::GE_Range(const unsigned N, const unsigned n, pablo::PabloBlock & pb) {
     222PabloAST * CC_Compiler::GE_Range(const unsigned N, const unsigned n, PabloBuilder &pb) {
    219223    if (N == 0) {
    220224        return pb.createOnes(); //Return a true literal.
     
    252256}
    253257
    254 PabloAST * CC_Compiler::LE_Range(const unsigned N, const unsigned n, pablo::PabloBlock & pb)
     258PabloAST * CC_Compiler::LE_Range(const unsigned N, const unsigned n, PabloBuilder &pb)
    255259{
    256260    /*
     
    266270}
    267271
    268 inline PabloAST * CC_Compiler::char_or_range_expr(const CodePointType lo, const CodePointType hi, pablo::PabloBlock & pb) {
     272inline PabloAST * CC_Compiler::char_or_range_expr(const CodePointType lo, const CodePointType hi, PabloBuilder &pb) {
    269273    if (lo == hi) {
    270274        return char_test_expr(lo, pb);
Note: See TracChangeset for help on using the changeset viewer.