Ignore:
Timestamp:
Apr 18, 2017, 12:51:26 PM (2 years ago)
Author:
nmedfort
Message:

Potential bug fix for 32-bit. Modified MRemap to check for Linux OS support. Added MMapAdvise to CBuilder.

File:
1 edited

Legend:

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

    r5408 r5411  
    1515
    1616static const auto INIT_SUFFIX = "_Init";
     17
     18static const auto TERMINATE_SUFFIX = "_Terminate";
    1719
    1820static const auto DO_SEGMENT_SUFFIX = "_DoSegment";
     
    99101    for (auto binding : mStreamSetOutputs) {
    100102        args->setName(binding.name + "ConsumerLogicalSegments");       
    101 //        args->addAttr(Attribute::NoCapture);
    102 //        args->addAttr(Attribute::ReadOnly);
    103103        ++args;
    104104    }
     
    119119        (++args)->setName(input.name + "AvailableItems");
    120120    }
     121
     122    // Create the terminate function prototype
     123    FunctionType * terminateType = FunctionType::get(iBuilder->getVoidTy(), {selfType}, false);
     124    Function * terminateFunc = Function::Create(terminateType, GlobalValue::ExternalLinkage, getName() + TERMINATE_SUFFIX, client);
     125    terminateFunc->setCallingConv(CallingConv::C);
     126    terminateFunc->setDoesNotThrow();
     127    terminateFunc->setDoesNotCapture(1);
     128    args = terminateFunc->arg_begin();
     129    args->setName("self");
    121130
    122131    /// INVESTIGATE: replace the accumulator methods with a single Exit method that handles any clean up and returns
     
    168177    return f;
    169178}
     179
     180Function * KernelInterface::getTerminateFunction() const {
     181    const auto name = getName() + TERMINATE_SUFFIX;
     182    Function * f = iBuilder->getModule()->getFunction(name);
     183    if (LLVM_UNLIKELY(f == nullptr)) {
     184        llvm::report_fatal_error("Cannot find " + name);
     185    }
     186    return f;
     187}
Note: See TracChangeset for help on using the changeset viewer.