Ignore:
Timestamp:
Aug 18, 2015, 5:47:47 PM (4 years ago)
Author:
cameron
Message:

icgrep linking

File:
1 edited

Legend:

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

    r4731 r4732  
    1414#include "pablo/pablo_compiler.h"
    1515#include <llvm/IR/Function.h>
     16#include <llvm/IR/Module.h>
    1617#include <llvm/ExecutionEngine/ExecutionEngine.h>
    1718#include <llvm/ExecutionEngine/MCJIT.h>
     
    2122#include <llvm/Support/TargetSelect.h>
    2223#include <llvm/Support/Host.h>
     24#ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
     25#include <UCD/precompiled_properties.h>
     26#endif
    2327
    2428#include "do_grep.h"
     
    7882
    7983void icgrep_Linking(Module * m, ExecutionEngine * e) {
    80     Function * printRegFn = m->getFunction("wrapped_print_register");
    81     if (printRegFn) {
    82         e->addGlobalMapping(cast<GlobalValue>(printRegFn), (void *)&wrapped_print_register);
     84    Module::FunctionListType & fns = m->getFunctionList();
     85    for (Module::FunctionListType::iterator it = fns.begin(), it_end = fns.end(); it != it_end; ++it) {
     86        std::string fnName = it->getName().str();
     87        if (fnName == "process_block") continue;
     88        if (fnName == "wrapped_print_register") {
     89            e->addGlobalMapping(cast<GlobalValue>(it), (void *)&wrapped_print_register);
     90        }
     91#ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
     92        else {
     93            const UCD::ExternalProperty & ep = UCD::resolveExternalProperty(fnName);
     94            e->addGlobalMapping(cast<GlobalValue>(it), std::get<0>(ep));
     95        }
     96#endif
    8397    }
    8498}
Note: See TracChangeset for help on using the changeset viewer.