Ignore:
Timestamp:
Jul 10, 2015, 4:51:39 PM (4 years ago)
Author:
nmedfort
Message:

Initial introduction of a PabloFunction? type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/compiler.cpp

    r4648 r4657  
    3030#include "resolve_properties.h"
    3131#include <llvm/Support/CommandLine.h>
     32#include <pablo/function.h>
    3233#include <re/printer_re.h>
    3334#include <pablo/printer_pablos.h>
     
    134135    }
    135136
    136     SymbolGenerator symbolGenerator;
    137     PabloBlock & main = PabloBlock::Create(symbolGenerator);
    138 
    139     CC_Compiler cc_compiler(main, encoding);
     137    PabloFunction function = PabloFunction::Create();
     138
     139    CC_Compiler cc_compiler(function, encoding);
    140140   
    141141    cc_compiler.compileByteClasses(re_ast);
    142142   
    143     auto basisBits = cc_compiler.getBasisBits(nameMap);
    144143    if (PrintCompiledCCcode) {
    145144      //Print to the terminal the AST that was generated by the character class compiler.
    146145      llvm::raw_os_ostream cerr(std::cerr);
    147146      cerr << "CC AST:" << "\n";
    148       PabloPrinter::print(main.statements(), cerr);
     147      PabloPrinter::print(function.getEntryBlock().statements(), cerr);
    149148    }
    150149   
    151150    RE_Compiler re_compiler(cc_compiler);
    152151    re_compiler.initializeRequiredStreams();
    153     re_compiler.finalizeMatchResult(re_compiler.compile(re_ast));
     152    re_compiler.finalizeMatchResult(function, re_compiler.compile(re_ast));
    154153
    155154    if (PrintCompiledREcode) {
     
    157156        llvm::raw_os_ostream cerr(std::cerr);
    158157        cerr << "Initial Pablo AST:\n";
    159         PabloPrinter::print(main.statements(), cerr);
     158        PabloPrinter::print(function.getEntryBlock().statements(), cerr);
    160159    }
    161160
    162161    // Scan through the pablo code and perform DCE and CSE
    163162    if (!DisablePabloCSE) {
    164         Simplifier::optimize(main);
     163        Simplifier::optimize(function);
    165164    }
    166165    if (PabloSinkingPass) {
    167         CodeSinking::optimize(main);
     166        CodeSinking::optimize(function);
    168167    }
    169168    #ifdef ENABLE_MULTIPLEXING
    170169    if (EnableMultiplexing) {
    171         AutoMultiplexing::optimize(basisBits, main);
     170        AutoMultiplexing::optimize(function);
    172171    }
    173172    #endif
     
    176175      llvm::raw_os_ostream cerr(std::cerr);
    177176      cerr << "Final Pablo AST:\n";
    178       PabloPrinter::print(main.statements(), cerr);
    179     }
    180 
    181     PabloCompiler pablo_compiler(basisBits);
     177      PabloPrinter::print(function.getEntryBlock().statements(), cerr);
     178    }
     179
     180    PabloCompiler pablo_compiler;
    182181    if (UsePregeneratedUnicode()) {
    183182        install_property_gc_fn_ptrs(pablo_compiler);
     
    189188    }
    190189    try {
    191         CompiledPabloFunction retVal = pablo_compiler.compile(main);
     190        CompiledPabloFunction retVal = pablo_compiler.compile(function);
    192191        releaseSlabAllocatorMemory();
    193192        return retVal;
Note: See TracChangeset for help on using the changeset viewer.