Ignore:
Timestamp:
Dec 22, 2016, 2:35:46 PM (2 years ago)
Author:
nmedfort
Message:

Modified memory alignment mechanism for GetPropertyValueGrepString? + misc. changes.

File:
1 edited

Legend:

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

    r5230 r5234  
    55 */
    66
    7 #include <grep_engine.h>
     7#include "grep_engine.h"
     8#include <llvm/ExecutionEngine/MCJIT.h>
     9#include <llvm/IR/Verifier.h>
     10#include <llvm/IRReader/IRReader.h>
     11#include <llvm/Support/CommandLine.h>
     12#include <llvm/Support/Debug.h>
     13#include <boost/filesystem.hpp>
     14#include <boost/iostreams/device/mapped_file.hpp>
    815#include <IDISA/idisa_builder.h>
    916#include <IDISA/idisa_target.h>
    10 #include <llvm/Support/CommandLine.h>
    11 #include <re/re_toolchain.h>
    12 #include <re/re_cc.h>
    13 
    14 #include <pablo/pablo_toolchain.h>
    15 #include <toolchain.h>
    16 #include <pablo/pablo_compiler.h>
    17 #include <kernels/pipeline.h>
    18 #include <llvm/IR/Function.h>
    19 #include <llvm/IR/Type.h>
    20 #include <llvm/IR/Module.h>
    21 #include <llvm/ExecutionEngine/MCJIT.h>
    22 #include <llvm/IRReader/IRReader.h>
    23 #include <llvm/Support/Debug.h>
    24 #include <llvm/IR/Verifier.h>
    2517#include <UCD/UnicodeNameData.h>
    2618#include <UCD/resolve_properties.h>
    27 
    28 
     19#include <kernels/cc_kernel.h>
     20#include <kernels/kernel.h>
     21#include <kernels/pipeline.h>
     22#include <kernels/pipeline.h>
     23#include <kernels/s2p_kernel.h>
     24#include <kernels/scanmatchgen.h>
    2925#include <kernels/streamset.h>
    30 #include <kernels/scanmatchgen.h>
    31 #include <kernels/s2p_kernel.h>
    32 #include <kernels/cc_kernel.h>
    33 #include <kernels/pipeline.h>
    34 
     26#include <pablo/pablo_compiler.h>
    3527#include <pablo/pablo_kernel.h>
    3628#include <pablo/pablo_toolchain.h>
    37 
    38 #include <llvm/IR/Intrinsics.h>
    39 #include "llvm/Support/SourceMgr.h"
    40 #include "llvm/IRReader/IRReader.h"
    41 #include "llvm/Linker/Linker.h"
    42 #include "llvm-c/Core.h"
    43 
    44 #include <fstream>
     29#include <pablo/pablo_toolchain.h>
     30#include <re/re_cc.h>
     31#include <re/re_toolchain.h>
     32#include <toolchain.h>
     33#include <iostream>
    4534#include <sstream>
    46 #include <iostream>
    47 #include <string>
    48 #include <stdint.h>
    49 
    50 #include <stdio.h>
    51 #include <stdlib.h>
    52 #include <unistd.h>
    53 #include <errno.h>
    54 #include <sys/types.h>
    55 #include <sys/stat.h>
    56 #include <stdexcept>
    57 #include <cctype>
    58 
    59 
    60 #include <llvm/Support/raw_os_ostream.h>
    61 
    62 // mmap system
    63 #include <boost/filesystem.hpp>
    64 #include <boost/iostreams/device/mapped_file.hpp>
    65 
    66 #include <fcntl.h>
    67 
    68 #include <kernels/kernel.h>
    69 
    7035#ifdef CUDA_ENABLED
    7136#include <IDISA/CudaDriver.h>
     
    470435const std::vector<std::string> & GrepEngine::grepPropertyValues(const std::string& propertyName) {
    471436    setParsedPropertyValues();
    472 
    473     std::string str = UCD::getPropertyValueGrepString(propertyName);
    474     char* grepInput = nullptr;
    475     posix_memalign( (void**)&grepInput, 32, str.size() * sizeof(char));
    476     strncpy(grepInput, str.c_str(), str.size());
    477     mGrepFunction(grepInput, str.size(), 0);
    478     free(grepInput);
    479 
    480     return getParsedProeprtyValues();
     437    const auto & str = UCD::getPropertyValueGrepString(propertyName);
     438    mGrepFunction(const_cast<char *>(str.data()), str.size(), 0);
     439    return getParsedPropertyValues();
    481440}
    482441
     
    614573
    615574
    616 std::vector<std::string> parsedPropertyValues;
     575static std::vector<std::string> parsedPropertyValues;
    617576
    618577extern "C" {
     
    627586}
    628587
    629 inline const std::vector<std::string>& getParsedProeprtyValues() {
     588inline const std::vector<std::string>& getParsedPropertyValues() {
    630589    return parsedPropertyValues;
    631590}
     
    634593void icgrep_Linking(Module * m, ExecutionEngine * e) {
    635594    Module::FunctionListType & fns = m->getFunctionList();
    636     for (Module::FunctionListType::iterator it = fns.begin(), it_end = fns.end(); it != it_end; ++it) {
     595    for (auto it = fns.begin(), it_end = fns.end(); it != it_end; ++it) {
    637596        std::string fnName = it->getName().str();
    638597        if (fnName == "s2p_block") continue;
     
    649608            e->addGlobalMapping(cast<GlobalValue>(it), (void *)&insert_property_values);
    650609        }
    651 #ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
    652         else {
    653             const UCD::ExternalProperty & ep = UCD::resolveExternalProperty(fnName);
    654             e->addGlobalMapping(cast<GlobalValue>(it), std::get<0>(ep));
    655         }
    656 #endif
    657     }
    658 }
    659 
     610    }
     611}
     612
Note: See TracChangeset for help on using the changeset viewer.