Ignore:
Timestamp:
Oct 31, 2014, 6:04:25 PM (5 years ago)
Author:
nmedfort
Message:

More Pablo IR manipulation functionality; finished use analysis optimizer (requires boost). Removed remaining LLVM optimization passes.

File:
1 edited

Legend:

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

    r4276 r4280  
    4646#include <llvm/Support/MathExtras.h>
    4747#include <llvm/Support/Casting.h>
     48#include <llvm/Support/Compiler.h>
    4849#include <llvm/Support/Debug.h>
    4950#include <llvm/Support/TargetSelect.h>
     
    5859
    5960//#define DUMP_GENERATED_IR
    60 //#define DUMP_OPTIMIZED_IR
    6161
    6262extern "C" {
     
    231231
    232232    //Un-comment this line in order to display the IR that has been generated by this module.
    233     #ifdef DUMP_GENERATED_IR
     233    #if defined(DUMP_GENERATED_IR)
    234234    mMod->dump();
    235235    #endif
     
    254254    fpm.add(new DataLayout(*mExecutionEngine->getDataLayout()));
    255255#endif
    256 
    257     fpm.add(createCorrelatedValuePropagationPass());
    258     fpm.add(createEarlyCSEPass());
    259     fpm.add(createInstructionCombiningPass());    //Simple peephole optimizations and bit-twiddling.
    260     fpm.add(createReassociatePass());             //Reassociate expressions.
    261     fpm.add(createGVNPass());                     //Eliminate common subexpressions.   
    262 
    263256    fpm.doInitialization();
    264 
    265257    fpm.run(*mFunction);
    266258
    267 #ifdef DUMP_OPTIMIZED_IR
    268     mMod->dump();
    269 #endif
    270259    mExecutionEngine->finalizeObject();
    271260
     
    520509        #undef CHECK_GENERAL_CODE_CATEGORY
    521510        Value * unicodeCategory = mMod->getOrInsertFunction("__get_category_" + callee->str(), mBitBlockType, mBasisBitsInputPtr, NULL);
    522         if (unicodeCategory == nullptr) {
     511        if (LLVM_UNLIKELY(unicodeCategory == nullptr)) {
    523512            throw std::runtime_error("Could not create static method call for unicode category \"" + callee->str() + "\"");
    524513        }
     
    543532        Value* expr = compileExpression(assign->getExpr());
    544533        mMarkerMap[assign->getName()] = expr;
    545         if (unlikely(assign->isOutputAssignment())) {
     534        if (LLVM_UNLIKELY(assign->isOutputAssignment())) {
    546535            SetOutputValue(expr, assign->getOutputIndex());
    547536        }
     
    717706        if (mi == mMarkerMap.end()) {
    718707            auto ci = mCalleeMap.find(call->getCallee());
    719             if (ci == mCalleeMap.end()) {
     708            if (LLVM_UNLIKELY(ci == mCalleeMap.end())) {
    720709                throw std::runtime_error("Unexpected error locating static function for \"" + call->getCallee()->str() + "\"");
    721710            }
     
    727716    {
    728717        auto f = mMarkerMap.find(var->getName());
    729         assert (f != mMarkerMap.end());
     718        if (LLVM_UNLIKELY(f == mMarkerMap.end())) {
     719            throw std::runtime_error(PabloPrinter::print(var) + " used before creation.");
     720        }
    730721        retVal = f->second;
    731722    }
Note: See TracChangeset for help on using the changeset viewer.