Changeset 5176


Ignore:
Timestamp:
Oct 4, 2016, 6:05:21 AM (2 years ago)
Author:
cameron
Message:

Engine deletion causes segfaults with LLVM 3.9 changes

Location:
icGREP/icgrep-devel/icgrep
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IDISA/llvm2ptx.h

    r5128 r5176  
    3333static int llvm2ptx(std::string IRFilename, std::string PTXFilename) {
    3434
    35   LLVMContext &Context = getGlobalContext();
     35  LLVMContext Context;
    3636
    3737  // Load the module to be compiled...
  • icGREP/icgrep-devel/icgrep/editd/editd.cpp

    r5173 r5176  
    270270preprocessFunctionType preprocessCodeGen() {
    271271                           
    272     Module * M = new Module("preprocess", getGlobalContext());
     272    LLVMContext TheContext;
     273    Module * M = new Module("preprocess", TheContext);
    273274    IDISA::IDISA_Builder * idb = IDISA::GetIDISA_Builder(M);
    274275
     
    302303editdFunctionType editdCodeGen() {
    303304                           
    304     Module * M = new Module("editd", getGlobalContext());
     305    Module * M = new Module("editd", TheContext);
    305306    IDISA::IDISA_Builder * idb = IDISA::GetIDISA_Builder(M);
    306307
     
    397398        run_second_filter(pattern_segs, total_len, 0.15);
    398399
    399     delete editdEngine;
    400     delete preprocessEngine;
    401400
    402401    return 0;
  • icGREP/icgrep-devel/icgrep/generate_predefined_ucd_functions.cpp

    r4860 r5176  
    271271            const auto pablo_metrix = computePabloDependencyChainMetrics(function);
    272272            (*LongestDependenceChainFile) << ',' << pablo_metrix.first << ',' << pablo_metrix.second;
    273             Module module("tmp", getGlobalContext());
     273            LLVMContext TheContext;
     274            Module module("tmp", TheContext);
    274275            llvm::Function * func = pc.compile(function, &module);
    275276            const auto llvm_metrix = computeLLVMDependencyChainMetrics(func);
     
    386387
    387388    property_list properties;
    388 
    389     PabloCompiler pc(VectorType::get(IntegerType::get(getGlobalContext(), 64), BLOCK_SIZE/64));
    390     Module * module = new Module("ucd", getGlobalContext());
     389    LLVMContext TheContext;
     390    PabloCompiler pc(VectorType::get(IntegerType::get(TheContext, 64), BLOCK_SIZE/64));
     391    Module * module = new Module("ucd", TheContext);
    391392    for (PropertyObject * obj : property_object_table) {
    392393        if (EnumeratedPropertyObject * enumObj = dyn_cast<EnumeratedPropertyObject>(obj)) {
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5165 r5176  
    4141#include "llvm/IRReader/IRReader.h"
    4242#include "llvm/Linker/Linker.h"
    43 
     43#include "llvm-c/Core.h"
    4444
    4545#include <fstream>
     
    7575static cl::OptionCategory bGrepOutputOptions("Output Options",
    7676                                             "These options control the output.");
     77static cl::opt<bool> SilenceFileErrors("s", cl::desc("Suppress messages for file errors."), cl::init(false),  cl::cat(bGrepOutputOptions));
     78
     79static cl::opt<bool> SuppressOutput("q", cl::desc("Suppress normal output; set return code only."), cl::init(false),  cl::cat(bGrepOutputOptions));
    7780
    7881static cl::opt<bool> NormalizeLineBreaks("normalize-line-breaks", cl::desc("Normalize line breaks to std::endl."), cl::init(false),  cl::cat(bGrepOutputOptions));
     
    99102        }
    100103    } else {
    101         std::cerr << "Error: cannot open " << fileName << " for processing. Skipped.\n";
    102         return;
     104        if (!SilenceFileErrors) {
     105            std::cerr << "Error: cannot open " << fileName << " for processing. Skipped.\n";
     106            return;
     107        }
    103108    }
    104109
     
    128133            source.close();
    129134        } catch (std::exception & e) {
    130             throw std::runtime_error("Boost mmap error: " + fileName + ": " + e.what());
     135            if (!SilenceFileErrors) {
     136                std::cerr << "Boost mmap error: " + fileName + ": " + e.what() + " Skipped.\n";
     137                return;
     138            }
    131139        }
    132140    } else {
     
    225233    int addrSpace = 0;
    226234    bool CPU_Only = true;
    227 
    228     Module * cpuM = new Module(moduleName+":cpu", getGlobalContext());
     235    LLVMContext TheContext;
     236    Module * cpuM = new Module(moduleName+":cpu", TheContext);
    229237    IDISA::IDISA_Builder * CPUBuilder = IDISA::GetIDISA_Builder(cpuM);
    230238    Module * M = cpuM; 
     
    234242    setNVPTXOption();
    235243    if(codegen::NVPTX){     
    236         Module * gpuM = new Module(moduleName+":gpu", getGlobalContext());
     244        Module * gpuM = new Module(moduleName+":gpu", TheContext);
    237245        IDISA::IDISA_Builder * GPUBuilder = IDISA::GetIDISA_GPU_Builder(gpuM);
    238246        M = gpuM;
     
    464472
    465473GrepEngine::~GrepEngine() {
    466     delete mEngine;
     474//    delete mEngine;
    467475}
    468476
     
    548556
    549557void PrintResult(bool CountOnly, std::vector<size_t> & total_CountOnly){
     558   
    550559    if(CountOnly){
    551560        if (!ShowFileNames) {
  • icGREP/icgrep-devel/icgrep/symboltable.cpp

    r5101 r5176  
    5353int main(int argc, char *argv[]) {
    5454
    55     Module * M = new Module("symboltable", getGlobalContext());
     55    LLVMContext TheContext;
     56
     57    Module * M = new Module("symboltable", TheContext);
    5658
    5759    IDISA::IDISA_Builder * idb = IDISA::GetIDISA_Builder(M);
  • icGREP/icgrep-devel/icgrep/u8u16.cpp

    r5154 r5176  
    333333
    334334u8u16FunctionType u8u16CodeGen(void) {
    335                            
    336     Module * M = new Module("u8u16", getGlobalContext());
     335    LLVMContext TheContext;                           
     336    Module * M = new Module("u8u16", TheContext);
    337337    IDISA::IDISA_Builder * idb = IDISA::GetIDISA_Builder(M);
    338338
     
    401401    }
    402402
    403     delete u8u16Engine;
    404 
    405403    return 0;
    406404}
  • icGREP/icgrep-devel/icgrep/wc.cpp

    r5142 r5176  
    202202
    203203wcFunctionType wcCodeGen(void) {
    204                            
    205     Module * M = new Module("wc", getGlobalContext());
     204    LLVMContext TheContext;                           
     205    Module * M = new Module("wc", TheContext);
    206206    IDISA::IDISA_Builder * idb = IDISA::GetIDISA_Builder(M);
    207207
     
    290290    }
    291291   
    292     delete wcEngine;
    293    
    294292    size_t maxCount = 0;
    295293    if (CountLines) maxCount = TotalLines;
Note: See TracChangeset for help on using the changeset viewer.