Ignore:
Timestamp:
Jan 5, 2017, 3:54:40 PM (2 years ago)
Author:
nmedfort
Message:

Code clean up to enforce proper calling order of KernelBuilder? methods

File:
1 edited

Legend:

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

    r5227 r5246  
    9595}
    9696
    97 
    9897void KernelInterface::setInitialArguments(std::vector<Value *> args) {
    9998    mInitialArguments = args;
    10099}
    101100
    102 void KernelInterface::createInstance() {
    103     mKernelInstance = iBuilder->CreateCacheAlignedAlloca(mKernelStateType);
    104     Module * m = iBuilder->getModule();
    105     std::vector<Value *> init_args = {mKernelInstance};
    106     for (auto a : mInitialArguments) {
    107         init_args.push_back(a);
    108     }
    109     std::string initFnName = mKernelName + init_suffix;
    110     Function * initMethod = m->getFunction(initFnName);
    111     if (!initMethod) {
    112         throw std::runtime_error("Cannot find " + initFnName);
    113     }
    114     iBuilder->CreateCall(initMethod, init_args);
    115 }
    116 
    117 Value * KernelInterface::createDoBlockCall(Value * self) {
     101Value * KernelInterface::createDoBlockCall(Value * self) const {
    118102    Module * m = iBuilder->getModule();
    119103    std::string doBlockName = mKernelName + doBlock_suffix;
     
    126110}
    127111
    128 Value * KernelInterface::createFinalBlockCall(Value * self, Value * remainingBytes) {
     112Value * KernelInterface::createFinalBlockCall(Value * self, Value * remainingBytes) const {
    129113    Module * m = iBuilder->getModule();
    130114    std::string finalBlockName = mKernelName + finalBlock_suffix;
     
    138122
    139123
    140 Value * KernelInterface::createDoSegmentCall(Value * self, Value * blksToDo) {
     124Value * KernelInterface::createDoSegmentCall(Value * self, Value * blksToDo) const {
    141125    Module * m = iBuilder->getModule();
    142126    std::string fnName = mKernelName + doSegment_suffix;
     
    148132}
    149133
    150 Value * KernelInterface::createGetAccumulatorCall(Value * self, std::string accumName) {
     134Value * KernelInterface::createGetAccumulatorCall(Value * self, std::string accumName) const {
    151135    Module * m = iBuilder->getModule();
    152136    std::string fnName = mKernelName + accumulator_infix + accumName;
Note: See TracChangeset for help on using the changeset viewer.