Changeset 5913 for icGREP


Ignore:
Timestamp:
Mar 18, 2018, 11:27:16 AM (12 months ago)
Author:
cameron
Message:

Restructuring step

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep/grep_engine.cpp

    r5908 r5913  
    7070   
    7171
    72 void accumulate_match_wrapper(intptr_t accum_addr, const size_t lineNum, char * line_start, char * line_end) {
     72extern "C" void accumulate_match_wrapper(intptr_t accum_addr, const size_t lineNum, char * line_start, char * line_end) {
    7373    reinterpret_cast<MatchAccumulator *>(accum_addr)->accumulate_match(lineNum, line_start, line_end);
    7474}
    7575
    76 void finalize_match_wrapper(intptr_t accum_addr, char * buffer_end) {
     76extern "C" void finalize_match_wrapper(intptr_t accum_addr, char * buffer_end) {
    7777    reinterpret_cast<MatchAccumulator *>(accum_addr)->finalize_match(buffer_end);
    7878}
     
    9999   
    100100    idb->SetInsertPoint(BasicBlock::Create(M->getContext(), "entry", mainFunc, 0));
    101    
    102101    StreamSetBuffer * ByteStream = pxDriver.addBuffer<SourceBuffer>(idb, idb->getStreamSetTy(1, 8));
    103102    kernel::Kernel * sourceK = pxDriver.addKernelInstance<kernel::MemorySourceKernel>(idb, idb->getInt8PtrTy());
     
    185184}
    186185
     186   
     187
     188   
    187189void GrepEngine::initFileResult(std::vector<std::string> & filenames) {
    188190    const unsigned n = filenames.size();
     
    192194}
    193195
     196void GrepEngine::initREs(std::vector<re::RE *> & REs) {
     197    if (mGrepRecordBreak == GrepRecordBreakKind::Unicode) {
     198        mBreakCC = re::makeCC(re::makeCC(0x0A, 0x0D), re::makeCC(re::makeCC(0x85), re::makeCC(0x2028, 0x2029)));
     199    } else if (mGrepRecordBreak == GrepRecordBreakKind::Null) {
     200        mBreakCC = re::makeByte(0);  // Null
     201    } else {
     202        mBreakCC = re::makeByte(0x0A); // LF
     203    }
     204    re::RE * anchorRE = mBreakCC;
     205    if (mGrepRecordBreak == GrepRecordBreakKind::Unicode) {
     206        re::Name * anchorName = re::makeName("UTF8_LB", re::Name::Type::Unicode);
     207        anchorName->setDefinition(UCD::UnicodeBreakRE());
     208        anchorRE = anchorName;
     209    }
     210   
     211    mREs = REs;
     212    for(unsigned i = 0; i < mREs.size(); ++i) {
     213        mREs[i] = resolveModesAndExternalSymbols(mREs[i]);
     214        mREs[i] = re::exclude_CC(mREs[i], mBreakCC);
     215        mREs[i] = resolveAnchors(mREs[i], anchorRE);
     216        re::gatherUnicodeProperties(mREs[i], mUnicodeProperties);
     217        mREs[i] = regular_expression_passes(mREs[i]);
     218    }
     219
     220}
     221
     222
     223   
    194224// Code Generation
    195225//
     
    201231}
    202232   
    203 std::pair<StreamSetBuffer *, StreamSetBuffer *> GrepEngine::grepPipeline(std::vector<re::RE *> & REs, StreamSetBuffer * ByteStream) {
     233std::pair<StreamSetBuffer *, StreamSetBuffer *> GrepEngine::grepPipeline(StreamSetBuffer * ByteStream) {
    204234    auto & idb = mGrepDriver->getBuilder();
    205235    const unsigned segmentSize = codegen::SegmentSize;
     
    211241   
    212242    //  Regular Expression Processing and Analysis Phase
    213     const auto nREs = REs.size();
     243    const auto nREs = mREs.size();
    214244    bool hasGCB[nREs];
    215245    bool anyGCB = false;
    216    
    217     std::set<re::Name *> UnicodeProperties;
    218    
    219     re::CC * breakCC = nullptr;
    220     std::string breakName;
    221     if (mGrepRecordBreak == GrepRecordBreakKind::Unicode) {
    222         breakCC = re::makeCC(re::makeCC(0x0A, 0x0D), re::makeCC(re::makeCC(0x85), re::makeCC(0x2028, 0x2029)));
    223     } else if (mGrepRecordBreak == GrepRecordBreakKind::Null) {
    224         breakCC = re::makeByte(0);  // Null
    225     } else {
    226         breakCC = re::makeByte(0x0A); // LF
    227     }
    228     re::RE * anchorRE = breakCC;
    229     if (mGrepRecordBreak == GrepRecordBreakKind::Unicode) {
    230         re::Name * anchorName = re::makeName("UTF8_LB", re::Name::Type::Unicode);
    231         anchorName->setDefinition(UCD::UnicodeBreakRE());
    232         anchorRE = anchorName;
    233     }
    234246
    235247    for(unsigned i = 0; i < nREs; ++i) {
    236         REs[i] = resolveModesAndExternalSymbols(REs[i]);
    237         REs[i] = re::exclude_CC(REs[i], breakCC);
    238         REs[i] = resolveAnchors(REs[i], anchorRE);
    239         re::gatherUnicodeProperties(REs[i], UnicodeProperties);
    240         REs[i] = regular_expression_passes(REs[i]);
    241         hasGCB[i] = hasGraphemeClusterBoundary(REs[i]);
     248        hasGCB[i] = hasGraphemeClusterBoundary(mREs[i]);
    242249        anyGCB |= hasGCB[i];
    243250    }
    244    
    245251    StreamSetBuffer * LineBreakStream = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize);
    246252    std::vector<StreamSetBuffer *> MatchResultsBufs(nREs);
     
    252258    bool isSimple = (nREs == 1) && (mGrepRecordBreak != GrepRecordBreakKind::Unicode) && (!anyGCB);
    253259    if (isSimple) {
    254         REs[0] = toUTF8(REs[0]);
    255     }
    256     if (isSimple && byteTestsWithinLimit(REs[0], ByteCClimit)) {
     260        mREs[0] = toUTF8(mREs[0]);
     261    }
     262    if (isSimple && byteTestsWithinLimit(mREs[0], ByteCClimit)) {
    257263        StreamSetBuffer * MatchResults = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize);
    258         kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ByteGrepKernel>(idb, REs[0]);
     264        kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ByteGrepKernel>(idb, mREs[0]);
    259265        mGrepDriver->makeKernelCall(icgrepK, {ByteStream}, {MatchResults});
    260266        MatchResultsBufs[0] = MatchResults;
    261         kernel::Kernel * breakK = mGrepDriver->addKernelInstance<kernel::DirectCharacterClassKernelBuilder>(idb, "breakCC", std::vector<re::CC *>{breakCC}, 1);
     267        kernel::Kernel * breakK = mGrepDriver->addKernelInstance<kernel::DirectCharacterClassKernelBuilder>(idb, "breakCC", std::vector<re::CC *>{mBreakCC}, 1);
    262268        mGrepDriver->makeKernelCall(breakK, {ByteStream}, {LineBreakStream});
    263     } else if (isSimple && hasTriCCwithinLimit(REs[0], ByteCClimit, prefixRE, suffixRE)) {
     269    } else if (isSimple && hasTriCCwithinLimit(mREs[0], ByteCClimit, prefixRE, suffixRE)) {
    264270        StreamSetBuffer * MatchResults = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize);
    265271        kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ByteBitGrepKernel>(idb, prefixRE, suffixRE);
    266272        mGrepDriver->makeKernelCall(icgrepK, {ByteStream}, {MatchResults});
    267273        MatchResultsBufs[0] = MatchResults;
    268         kernel::Kernel * breakK = mGrepDriver->addKernelInstance<kernel::DirectCharacterClassKernelBuilder>(idb, "breakCC", std::vector<re::CC *>{breakCC}, 1);
     274        kernel::Kernel * breakK = mGrepDriver->addKernelInstance<kernel::DirectCharacterClassKernelBuilder>(idb, "breakCC", std::vector<re::CC *>{mBreakCC}, 1);
    269275        mGrepDriver->makeKernelCall(breakK, {ByteStream}, {LineBreakStream});
    270276    } else {
     277       
    271278        StreamSetBuffer * BasisBits = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(encodingBits, 1), baseBufferSize);
    272279        kernel::Kernel * s2pk = nullptr;
     
    292299            LineBreakStream = LineFeedStream;
    293300        } else if (mGrepRecordBreak == GrepRecordBreakKind::Null) {
    294             kernel::Kernel * breakK = mGrepDriver->addKernelInstance<kernel::ParabixCharacterClassKernelBuilder>(idb, "Null", std::vector<re::CC *>{breakCC}, 8);
     301            kernel::Kernel * breakK = mGrepDriver->addKernelInstance<kernel::ParabixCharacterClassKernelBuilder>(idb, "Null", std::vector<re::CC *>{mBreakCC}, 8);
    295302            mGrepDriver->makeKernelCall(breakK, {BasisBits}, {LineBreakStream});
    296303        } else {
     
    300307        std::map<std::string, StreamSetBuffer *> propertyStream;
    301308        if (PropertyKernels) {
    302             for (auto p : UnicodeProperties) {
     309            for (auto p : mUnicodeProperties) {
    303310                auto name = p->getFullName();
    304311                StreamSetBuffer * s = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize);
     
    326333            std::set<re::Name *> UnicodeProperties;
    327334            if (PropertyKernels) {
    328                 re::gatherUnicodeProperties(REs[i], UnicodeProperties);
     335                re::gatherUnicodeProperties(mREs[i], UnicodeProperties);
    329336                for (auto p : UnicodeProperties) {
    330337                    auto name = p->getFullName();
     
    340347            }
    341348            if (CC_Multiplexing) {
    342                 const auto UnicodeSets = re::collectUnicodeSets(REs[i], std::set<re::Name *>({re::makeZeroWidth("\\b{g}")}));
     349                const auto UnicodeSets = re::collectUnicodeSets(mREs[i], std::set<re::Name *>({re::makeZeroWidth("\\b{g}")}));
    343350                StreamSetBuffer * const MatchResults = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize);
    344351                if (UnicodeSets.size() <= 1) {
    345                     kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, REs[i], externalStreamNames);
     352                    kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, mREs[i], externalStreamNames);
    346353                    mGrepDriver->makeKernelCall(icgrepK, icgrepInputSets, {MatchResults});
    347354                    MatchResultsBufs[i] = MatchResults;
    348355                } else {
    349356                    mpx = make_unique<MultiplexedAlphabet>("mpx", UnicodeSets);
    350                     REs[i] = transformCCs(mpx.get(), REs[i]);
     357                    mREs[i] = transformCCs(mpx.get(), mREs[i]);
    351358                    std::vector<re::CC *> mpx_basis = mpx->getMultiplexedCCs();
    352359                    auto numOfCharacterClasses = mpx_basis.size();
     
    356363    //                kernel::Kernel * ccK = mGrepDriver->addKernelInstance<kernel::CharClassesKernel>(idb, std::move(mpx_basis), true);
    357364    //                mGrepDriver->makeKernelCall(ccK, {ByteStream}, {CharClasses});
    358                     kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, REs[i], externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()});
     365                    kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, mREs[i], externalStreamNames, std::vector<cc::Alphabet *>{mpx.get()});
    359366                    icgrepInputSets.push_back(CharClasses);
    360367                    mGrepDriver->makeKernelCall(icgrepK, icgrepInputSets, {MatchResults});
     
    363370            } else {
    364371                StreamSetBuffer * MatchResults = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize);
    365                 kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, REs[i], externalStreamNames);
     372                kernel::Kernel * icgrepK = mGrepDriver->addKernelInstance<kernel::ICGrepKernel>(idb, mREs[i], externalStreamNames);
    366373                mGrepDriver->makeKernelCall(icgrepK, icgrepInputSets, {MatchResults});
    367374                MatchResultsBufs[i] = MatchResults;
     
    369376        }
    370377    }
     378
    371379    StreamSetBuffer * MergedResults = MatchResultsBufs[0];
    372     if (REs.size() > 1) {
     380    if (mREs.size() > 1) {
    373381        MergedResults = mGrepDriver->addBuffer<CircularBuffer>(idb, idb->getStreamSetTy(1, 1), baseBufferSize);
    374         kernel::Kernel * streamsMergeK = mGrepDriver->addKernelInstance<kernel::StreamsMerge>(idb, 1, REs.size());
     382        kernel::Kernel * streamsMergeK = mGrepDriver->addKernelInstance<kernel::StreamsMerge>(idb, 1, mREs.size());
    375383        mGrepDriver->makeKernelCall(streamsMergeK, MatchResultsBufs, {MergedResults});
    376384    }
    377385    StreamSetBuffer * Matches = MergedResults;
    378 
    379386    if (mMoveMatchesToEOL) {
    380387        StreamSetBuffer * OriginalMatches = Matches;
     
    383390        mGrepDriver->makeKernelCall(matchedLinesK, {OriginalMatches, LineBreakStream}, {Matches});
    384391    }
    385 
    386392    if (InvertMatchFlag) {
    387393        kernel::Kernel * invertK = mGrepDriver->addKernelInstance<kernel::InvertMatchesKernel>(idb);
     
    397403        mGrepDriver->makeKernelCall(untilK, {AllMatches}, {Matches});
    398404    }
     405
    399406    return std::pair<StreamSetBuffer *, StreamSetBuffer *>(LineBreakStream, Matches);
    400407}
     
    404411//
    405412
    406 void GrepEngine::grepCodeGen(std::vector<re::RE *> REs) {
     413void GrepEngine::grepCodeGen() {
    407414
    408415    assert (mGrepDriver == nullptr);
     
    428435    StreamSetBuffer * LineBreakStream;
    429436    StreamSetBuffer * Matches;
    430     std::tie(LineBreakStream, Matches) = grepPipeline(REs, ByteStream);
     437    std::tie(LineBreakStream, Matches) = grepPipeline(ByteStream);
    431438
    432439    kernel::Kernel * matchCountK = mGrepDriver->addKernelInstance<kernel::PopcountKernel>(idb);
     
    498505}
    499506
    500 void EmitMatchesEngine::grepCodeGen(std::vector<re::RE *> REs) {
     507void EmitMatchesEngine::grepCodeGen() {
    501508    assert (mGrepDriver == nullptr);
    502509    mGrepDriver = new ParabixDriver("engine");
     
    523530    StreamSetBuffer * LineBreakStream;
    524531    StreamSetBuffer * Matches;
    525     std::tie(LineBreakStream, Matches) = grepPipeline(REs, ByteStream);
     532    std::tie(LineBreakStream, Matches) = grepPipeline(ByteStream);
    526533
    527534    kernel::Kernel * scanMatchK = mGrepDriver->addKernelInstance<kernel::ScanMatchKernel>(idb);
     
    642649    }
    643650    // Main thread also does the work;
    644 
    645651    DoGrepThreadMethod();
    646652    for(unsigned i = 1; i < numOfThreads; ++i) {
  • icGREP/icgrep-devel/icgrep/grep/grep_engine.h

    r5894 r5913  
    3131};
    3232
    33 void accumulate_match_wrapper(intptr_t accum_addr, const size_t lineNum, char * line_start, char * line_end);
     33extern "C" void accumulate_match_wrapper(intptr_t accum_addr, const size_t lineNum, char * line_start, char * line_end);
    3434
    35 void finalize_match_wrapper(intptr_t accum_addr, char * buffer_end);
     35extern "C" void finalize_match_wrapper(intptr_t accum_addr, char * buffer_end);
    3636
    3737void grepBuffer(re::RE * pattern, const char * buffer, size_t bufferLength, MatchAccumulator * accum);
     
    4646    void setRecordBreak(GrepRecordBreakKind b);
    4747    void initFileResult(std::vector<std::string> & filenames);
    48     virtual void grepCodeGen(std::vector<re::RE *> REs);
     48    void initREs(std::vector<re::RE *> & REs);
     49    virtual void grepCodeGen();
    4950    bool searchAllFiles();
    5051    void * DoGrepThreadMethod();
    5152
    5253protected:
    53     std::pair<parabix::StreamSetBuffer *, parabix::StreamSetBuffer *> grepPipeline(std::vector<re::RE *> & REs, parabix::StreamSetBuffer * ByteStream);
     54    std::pair<parabix::StreamSetBuffer *, parabix::StreamSetBuffer *> grepPipeline(parabix::StreamSetBuffer * ByteStream);
    5455
    5556    virtual uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx);
     
    6667    bool grepMatchFound;
    6768    GrepRecordBreakKind mGrepRecordBreak;
    68 
     69   
     70    std::vector<re:: RE *> mREs;
     71    std::set<re::Name *> mUnicodeProperties;
     72    re::CC * mBreakCC;
    6973    std::unique_ptr<cc::MultiplexedAlphabet> mpx;
    7074    std::string mFileSuffix;
     
    7680public:
    7781    EmitMatchesEngine();
    78     void grepCodeGen(std::vector<re::RE *> REs) override;
     82    void grepCodeGen() override;
    7983private:
    8084    uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) override;
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r5900 r5913  
    172172    grep::InitializeCommandLineInterface(argc, argv);
    173173   
    174     const auto REs = readExpressions();
     174    auto REs = readExpressions();
    175175
    176176    std::vector<std::string> allFiles = getFullFileList(inputFiles);
     
    204204        grepEngine->setRecordBreak(grep::GrepRecordBreakKind::LF);
    205205    }
    206    
    207     grepEngine->grepCodeGen(REs);
    208 
     206    grepEngine->initREs(REs);
     207    grepEngine->grepCodeGen();
    209208    grepEngine->initFileResult(allFiles);
    210    
    211209    bool matchFound = grepEngine->searchAllFiles();
    212    
    213210    delete(grepEngine);
    214211   
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.cpp

    r5856 r5913  
    33#include <IR_Gen/idisa_target.h>
    44#include <toolchain/toolchain.h>
     5#include <llvm/Support/DynamicLibrary.h>           // for LoadLibraryPermanently
     6#include <llvm/ExecutionEngine/RuntimeDyld.h>
     7#include <llvm/ExecutionEngine/RTDyldMemoryManager.h>
    58#include <llvm/ExecutionEngine/ExecutionEngine.h>  // for EngineBuilder
    69#include <llvm/IR/LegacyPassManager.h>             // for PassManager
     
    4750    InitializeNativeTargetAsmPrinter();
    4851    InitializeNativeTargetAsmParser();
    49 
    50     PassRegistry * Registry = PassRegistry::getPassRegistry();
    51     initializeCore(*Registry);
    52     initializeCodeGen(*Registry);
    53     initializeLowerIntrinsicsPass(*Registry);
     52    llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
     53
     54    preparePassManager();
    5455
    5556    std::string errMessage;
     
    143144}
    144145
    145 void ParabixDriver::finalizeObject() {
    146 
    147     legacy::PassManager PM;
     146void ParabixDriver::preparePassManager() {
     147    PassRegistry * Registry = PassRegistry::getPassRegistry();
     148    initializeCore(*Registry);
     149    initializeCodeGen(*Registry);
     150    initializeLowerIntrinsicsPass(*Registry);
     151   
    148152    if (LLVM_UNLIKELY(codegen::ShowUnoptimizedIROption != codegen::OmittedOption)) {
    149153        if (LLVM_LIKELY(mIROutputStream == nullptr)) {
     
    155159            }
    156160        }
    157         PM.add(createPrintModulePass(*mIROutputStream));
     161        mPassManager.add(createPrintModulePass(*mIROutputStream));
    158162    }
    159163    if (IN_DEBUG_MODE || LLVM_UNLIKELY(codegen::DebugOptionIsSet(codegen::VerifyIR))) {
    160         PM.add(createVerifierPass());
    161     }
    162     PM.add(createPromoteMemoryToRegisterPass());    // Promote stack variables to constants or PHI nodes
    163     PM.add(createCFGSimplificationPass());          // Remove dead basic blocks and unnecessary branch statements / phi nodes
    164     PM.add(createEarlyCSEPass());                   // Simple common subexpression elimination pass
    165     PM.add(createInstructionCombiningPass());       // Simple peephole optimizations and bit-twiddling.
    166     PM.add(createReassociatePass());                // Canonicalizes commutative expressions
    167     PM.add(createGVNPass());                        // Global value numbering redundant expression elimination pass
    168     PM.add(createCFGSimplificationPass());          // Repeat CFG Simplification to "clean up" any newly found redundant phi nodes
    169 
     164        mPassManager.add(createVerifierPass());
     165    }
     166    mPassManager.add(createPromoteMemoryToRegisterPass());    // Promote stack variables to constants or PHI nodes
     167    mPassManager.add(createCFGSimplificationPass());          // Remove dead basic blocks and unnecessary branch statements / phi nodes
     168    mPassManager.add(createEarlyCSEPass());                   // Simple common subexpression elimination pass
     169    mPassManager.add(createInstructionCombiningPass());       // Simple peephole optimizations and bit-twiddling.
     170    mPassManager.add(createReassociatePass());                // Canonicalizes commutative expressions
     171    mPassManager.add(createGVNPass());                        // Global value numbering redundant expression elimination pass
     172    mPassManager.add(createCFGSimplificationPass());          // Repeat CFG Simplification to "clean up" any newly found redundant phi nodes
     173   
    170174    if (LLVM_UNLIKELY(codegen::ShowIROption != codegen::OmittedOption)) {
    171175        if (LLVM_LIKELY(mIROutputStream == nullptr)) {
     
    177181            }
    178182        }
    179         PM.add(createPrintModulePass(*mIROutputStream));
    180     }
    181 
     183        mPassManager.add(createPrintModulePass(*mIROutputStream));
     184    }
     185   
    182186#if LLVM_VERSION_INTEGER >= LLVM_VERSION_CODE(3, 7, 0)
    183187    if (LLVM_UNLIKELY(codegen::ShowASMOption != codegen::OmittedOption)) {
     
    188192            mASMOutputStream = new raw_fd_ostream(STDERR_FILENO, false, true);
    189193        }
    190         if (LLVM_UNLIKELY(mTarget->addPassesToEmitFile(PM, *mASMOutputStream, TargetMachine::CGFT_AssemblyFile))) {
     194        if (LLVM_UNLIKELY(mTarget->addPassesToEmitFile(mPassManager, *mASMOutputStream, TargetMachine::CGFT_AssemblyFile))) {
    191195            report_fatal_error("LLVM error: could not add emit assembly pass");
    192196        }
    193197    }
    194198#endif
     199}
     200
     201
     202void ParabixDriver::finalizeObject() {
    195203
    196204    Module * module = nullptr;
     
    201209            module = kernel->getModule(); assert (module);
    202210            module->setTargetTriple(mMainModule->getTargetTriple());
    203             PM.run(*module);
     211            mPassManager.run(*module);
    204212        }
    205213        module = mMainModule;
    206214        iBuilder->setKernel(nullptr);
    207         PM.run(*mMainModule);
     215        mPassManager.run(*mMainModule);
    208216        for (Kernel * const kernel : mPipeline) {
    209217            if (LLVM_UNLIKELY(kernel->getModule() == nullptr)) {
     
    220228
    221229bool ParabixDriver::hasExternalFunction(llvm::StringRef functionName) const {
    222     return mEngine->getPointerToNamedFunction(functionName, false) != nullptr;
     230    return RTDyldMemoryManager::getSymbolAddressInProcess(functionName);
    223231}
    224232
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.h

    r5735 r5913  
    22#define CPUDRIVER_H
    33#include "driver.h"
     4#include <llvm/IR/LegacyPassManager.h>             // for PassManager
    45
    56namespace llvm { class ExecutionEngine; }
     
    2930
    3031private:
     32    void preparePassManager();
    3133
    3234    llvm::Function * addLinkFunction(llvm::Module * mod, llvm::StringRef name, llvm::FunctionType * type, void * functionPtr) const override;
     
    3436private:
    3537    llvm::TargetMachine *                                   mTarget;
     38    llvm::legacy::PassManager                               mPassManager;
    3639    llvm::ExecutionEngine *                                 mEngine;
    3740    ParabixObjectCache *                                    mCache;
Note: See TracChangeset for help on using the changeset viewer.