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/pablo/pablo_kernel.cpp

    r5245 r5246  
    1717using namespace IDISA;
    1818
    19 Var * PabloKernel::addInput(const std::string name, Type * const type) {
     19Var * PabloKernel::addInput(const std::string & name, Type * const type) {
    2020    Var * param = new (mAllocator) Var(mSymbolTable->make(name, iBuilder), type, mAllocator, true);
    2121    mInputs.push_back(param);
     
    8080}
    8181
    82 void PabloKernel::generateDoBlockMethod() {
     82void PabloKernel::generateDoBlockMethod() const {
    8383    auto savePoint = iBuilder->saveIP();
    8484    Module * const m = iBuilder->getModule();
     
    8787    mPabloCompiler->compile(self, f);
    8888    Value * produced = getProducedItemCount(self);
    89     produced = iBuilder->CreateAdd(produced, ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride()));
     89    produced = iBuilder->CreateAdd(produced, iBuilder->getSize(iBuilder->getStride()));
    9090    setProducedItemCount(self, produced);
    9191    iBuilder->CreateRetVoid();
     
    9696}
    9797
    98 void PabloKernel::generateFinalBlockMethod() {
     98void PabloKernel::generateFinalBlockMethod() const {
    9999    auto savePoint = iBuilder->saveIP();
    100100    Module * m = iBuilder->getModule();
     
    117117    /* Adjust the produced item count */
    118118    Value * produced = getProducedItemCount(self);
    119     produced = iBuilder->CreateSub(produced, ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride()));
     119    produced = iBuilder->CreateSub(produced, iBuilder->getSize(iBuilder->getStride()));
    120120    setProducedItemCount(self, iBuilder->CreateAdd(produced, remaining));
    121121    iBuilder->CreateRetVoid();
     
    126126}
    127127
    128 void PabloKernel::initializeKernelState(Value * self) {   
    129     iBuilder->CreateStore(ConstantAggregateZero::get(mKernelStateType), self);
     128void PabloKernel::initializeKernelState(Value * self) const {
     129    iBuilder->CreateStore(ConstantAggregateZero::get(mKernelStateType), self);   
    130130}
    131131
Note: See TracChangeset for help on using the changeset viewer.