Ignore:
Timestamp:
Feb 3, 2017, 1:25:53 PM (2 years ago)
Author:
nmedfort
Message:

Partial removal of BlockNo?

File:
1 edited

Legend:

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

    r5292 r5297  
    2727    iBuilder->setModule(client);
    2828    if (mKernelStateType == nullptr) {
    29         throw std::runtime_error("Kernel interface " + mKernelName + " not yet finalized.");
     29        throw std::runtime_error("Kernel interface " + getName() + " not yet finalized.");
    3030    }
    3131    PointerType * selfType = PointerType::getUnqual(mKernelStateType);
     
    3737    }
    3838    FunctionType * initType = FunctionType::get(iBuilder->getVoidTy(), initParameters, false);
    39     Function * init = Function::Create(initType, GlobalValue::ExternalLinkage, mKernelName + INIT_SUFFIX, client);
     39    Function * init = Function::Create(initType, GlobalValue::ExternalLinkage, getName() + INIT_SUFFIX, client);
    4040    init->setCallingConv(CallingConv::C);
    4141    init->setDoesNotThrow();
    4242    auto args = init->arg_begin();
    43     args++->setName("self");
     43    args->setName("self");
    4444    for (auto binding : mScalarInputs) {
    45         args++->setName(binding.name);
     45        (++args)->setName(binding.name);
    4646    }
    47     assert (args == init->arg_end());
     47    assert ((++args) == init->arg_end());
    4848
    4949    // Create the doSegment function prototype.
     
    5353    }
    5454    FunctionType * doSegmentType = FunctionType::get(iBuilder->getVoidTy(), doSegmentParameters, false);
    55     Function * doSegment = Function::Create(doSegmentType, GlobalValue::ExternalLinkage, mKernelName + DO_SEGMENT_SUFFIX, client);
     55    Function * doSegment = Function::Create(doSegmentType, GlobalValue::ExternalLinkage, getName() + DO_SEGMENT_SUFFIX, client);
    5656    doSegment->setCallingConv(CallingConv::C);
    5757    doSegment->setDoesNotThrow();
    5858    doSegment->setDoesNotCapture(1); // for self parameter only.
    5959    args = doSegment->arg_begin();
    60     args++->setName("self");
    61     args++->setName("doFinal");
     60    args->setName("self");
     61    (++args)->setName("doFinal");
    6262    for (auto ss : mStreamSetInputs) {
    63         args++->setName(ss.name + "_availableItems");
     63        (++args)->setName(ss.name + "_availableItems");
    6464    }
    65     assert (args == doSegment->arg_end());
     65    assert ((++args) == doSegment->arg_end());
    6666
    6767    // Add any additional kernel declarations
     
    7171    for (const auto & binding : mScalarOutputs) {
    7272        FunctionType * accumFnType = FunctionType::get(binding.type, {selfType}, false);
    73         Function * accumFn = Function::Create(accumFnType, GlobalValue::ExternalLinkage, mKernelName + ACCUMULATOR_INFIX + binding.name, client);
     73        Function * accumFn = Function::Create(accumFnType, GlobalValue::ExternalLinkage, getName() + ACCUMULATOR_INFIX + binding.name, client);
    7474        accumFn->setCallingConv(CallingConv::C);
    7575        accumFn->setDoesNotThrow();
    76         auto self = accumFn->arg_begin();
    77         self->setName("self");
     76        accumFn->setDoesNotCapture(1);
     77        auto args = accumFn->arg_begin();
     78        args->setName("self");
     79        assert ((++args) == accumFn->arg_end());
    7880    }
    7981
     
    8789
    8890llvm::Function * KernelInterface::getAccumulatorFunction(const std::string & accumName) const {
    89     const auto name = mKernelName + ACCUMULATOR_INFIX + accumName;
     91    const auto name = getName() + ACCUMULATOR_INFIX + accumName;
    9092    Function * f = iBuilder->getModule()->getFunction(name);
    9193    if (LLVM_UNLIKELY(f == nullptr)) {
     
    9698
    9799Function * KernelInterface::getInitFunction() const {
    98     const auto name = mKernelName + INIT_SUFFIX;
     100    const auto name = getName() + INIT_SUFFIX;
    99101    Function * f = iBuilder->getModule()->getFunction(name);
    100102    if (LLVM_UNLIKELY(f == nullptr)) {
     
    105107
    106108Function * KernelInterface::getDoSegmentFunction() const {
    107     const auto name = mKernelName + DO_SEGMENT_SUFFIX;
     109    const auto name = getName() + DO_SEGMENT_SUFFIX;
    108110    Function * f = iBuilder->getModule()->getFunction(name);
    109111    if (LLVM_UNLIKELY(f == nullptr)) {
Note: See TracChangeset for help on using the changeset viewer.