Changeset 5920 for icGREP


Ignore:
Timestamp:
Mar 20, 2018, 3:06:59 PM (12 months ago)
Author:
cameron
Message:

Some small fixes and cleanup

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.cpp

    r5919 r5920  
    2727#include <kernels/kernel.h>
    2828#include <llvm/IR/Verifier.h>
    29 #ifdef ORCJIT
    3029#include "llvm/IR/Mangler.h"
     30#ifdef ORCJIT
    3131#if LLVM_VERSION_INTEGER < LLVM_VERSION_CODE(4, 0, 0)
    3232#include <llvm/ExecutionEngine/Orc/JITSymbol.h>
     
    107107#ifdef ORCJIT
    108108    mCompileLayer = make_unique<CompileLayerT>(mObjectLayer, orc::SimpleCompiler(*mTarget));
    109     /*
    110     mOptimizeLayer = make_unique<OptimizeLayerT>
    111                         (mCompileLayer,
    112                          [this](std::unique_ptr<Module> M) {mPassManager.run(M.get()); return M;});
    113      */
    114109#else
    115110    mEngine = builder.create();
     
    182177}
    183178
    184 #if 0 //def ORCJIT
    185 OptimizeLayerT::ModuleSetHandleT ParabixDriver::addModule(std::unique_ptr<Module> M) {
    186     // Build our symbol resolver:
    187     // Lambda 1: Look back into the JIT itself to find symbols that are part of
    188     //           the same "logical dylib".
    189     // Lambda 2: Search for external symbols in the host process.
    190     auto Resolver = orc::createLambdaResolver(
    191                                          [&](const std::string &Name) {
    192                                              if (auto Sym = mOptimizeLayer->findSymbol(Name, false))
    193                                                  return Sym;
    194                                              return orc::JITSymbol(nullptr);
    195                                          },
    196                                          [](const std::string &Name) {
    197                                              if (auto SymAddr =
    198                                                  RTDyldMemoryManager::getSymbolAddressInProcess(Name))
    199                                                  return orc::JITSymbol(SymAddr, JITSymbolFlags::Exported);
    200                                              return orc::JITSymbol(nullptr);
    201                                          });
    202    
    203     // Build a singleton module set to hold our module.
    204     std::vector<std::unique_ptr<Module>> Ms;
    205     Ms.push_back(std::move(M));
    206    
    207     // Add the set to the JIT with the resolver we created above and a newly
    208     // created SectionMemoryManager.
    209     return mOptimizeLayer->addModuleSet(std::move(Ms),
    210                                       make_unique<SectionMemoryManager>(),
    211                                       std::move(Resolver));
    212 }
    213 #endif
    214 
    215179
    216180Function * ParabixDriver::addLinkFunction(Module * mod, llvm::StringRef name, FunctionType * type, void * functionPtr) const {
     
    230194    return f;
    231195}
    232 
    233 
    234196
    235197std::string ParabixDriver::getMangledName(std::string s) {
     
    240202    return MangledName;
    241203}
    242 
    243204
    244205void ParabixDriver::preparePassManager() {
     
    331292            module = kernel->getModule(); assert (module);
    332293            module->setTargetTriple(mMainModule->getTargetTriple());
    333 #ifndef ORCJIT
    334294            mPassManager.run(*module);
    335 #endif
    336295        }
    337296        module = mMainModule;
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.h

    r5919 r5920  
    1111#define ORCJIT
    1212#endif
     13
    1314#ifdef ORCJIT
    1415#include <llvm/ExecutionEngine/Orc/CompileUtils.h>
    15 #if LLVM_VERSION_INTEGER <= LLVM_VERSION_CODE(5, 0, 0)
     16
     17#if LLVM_VERSION_INTEGER < LLVM_VERSION_CODE(5, 0, 0)
    1618#include <llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h>
    1719#else
     
    2123#include <llvm/ExecutionEngine/Orc/IRTransformLayer.h>
    2224
    23 #if LLVM_VERSION_INTEGER <= LLVM_VERSION_CODE(5, 0, 0)
     25#if LLVM_VERSION_INTEGER < LLVM_VERSION_CODE(5, 0, 0)
    2426typedef llvm::orc::ObjectLinkingLayer<> ObjectLayerT;
    2527typedef llvm::orc::IRCompileLayer<ObjectLayerT> CompileLayerT;
     
    2830typedef llvm::orc::IRCompileLayer<ObjectLayerT, llvm::orc::SimpleCompiler> CompileLayerT;
    2931#endif
    30 
    31 using OptimizeFnT = std::function<std::unique_ptr<llvm::Module>(std::unique_ptr<llvm::Module>)>;
    32 typedef llvm::orc::IRTransformLayer<CompileLayerT, OptimizeFnT> OptimizeLayerT;
    3332
    3433#endif
     
    6867    ObjectLayerT mObjectLayer;
    6968    std::unique_ptr<CompileLayerT> mCompileLayer;
    70    
    71     //std::unique_ptr<OptimizeLayerT> mOptimizeLayer;
    72    
    73     //OptimizeLayerT::ModuleSetHandleT addModule(std::unique_ptr<llvm::Module> M);
    7469
    7570#else
Note: See TracChangeset for help on using the changeset viewer.