Changeset 4273


Ignore:
Timestamp:
Oct 28, 2014, 2:05:29 PM (4 years ago)
Author:
cameron
Message:

CodeGenOpt::Level::Less optimization improves performance with while loops

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
2 edited

Legend:

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

    r4270 r4273  
    9191, mBasisBitsAddr(nullptr)
    9292, mOutputAddrPtr(nullptr)
     93, mMaxPabloWhileDepth(0)
    9394{
    9495    //Create the jit execution engine.up
    9596    InitializeNativeTarget();
    96     std::string ErrStr;
    97     mExecutionEngine = EngineBuilder(mMod).setUseMCJIT(true).setErrorStr(&ErrStr).setOptLevel(CodeGenOpt::Level::None).create();
    98     if (mExecutionEngine == nullptr) {
    99         throw std::runtime_error("Could not create ExecutionEngine: " + ErrStr);
    100     }
    10197
    10298    InitializeNativeTargetAsmPrinter();
     
    195191    //Use the pass manager to run optimizations on the function.
    196192    FunctionPassManager fpm(mMod);
     193    std::string ErrStr;
     194
     195    if (mMaxPabloWhileDepth == 0) {
     196      mExecutionEngine = EngineBuilder(mMod).setUseMCJIT(true).setErrorStr(&ErrStr).setOptLevel(CodeGenOpt::Level::None).create();
     197    }
     198    else {
     199      mExecutionEngine = EngineBuilder(mMod).setUseMCJIT(true).setErrorStr(&ErrStr).setOptLevel(CodeGenOpt::Level::Less).create();
     200    }
     201    if (mExecutionEngine == nullptr) {
     202        throw std::runtime_error("Could not create ExecutionEngine: " + ErrStr);
     203    }
     204
    197205
    198206#ifdef USE_LLVM_3_5
     
    578586        // will refer to the previous value.
    579587        ++mNestingDepth;
     588        if (mMaxPabloWhileDepth < mNestingDepth) mMaxPabloWhileDepth = mNestingDepth;
    580589        compileStatements(whileStatement->getBody());
     590       
    581591        // Reset the carry queue index. Note: this ought to be changed in the future. Currently this assumes
    582592        // that compiling the while body twice will generate the equivalent IR. This is not necessarily true
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h

    r4270 r4273  
    140140    Value*                              mOutputAddrPtr;
    141141
     142    int                                 mMaxPabloWhileDepth;
     143
    142144    StringToValueMap                    mCalleeMap;
    143145};
Note: See TracChangeset for help on using the changeset viewer.