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/stdout_kernel.cpp

    r5243 r5246  
    1111// The doBlock method is deprecated.   But in case it is used, just call doSegment with
    1212// 1 as the number of blocks to do.
    13 void StdOutKernel::generateDoBlockMethod() {
     13void StdOutKernel::generateDoBlockMethod() const {
    1414    auto savePoint = iBuilder->saveIP();
    1515    Module * m = iBuilder->getModule();
     
    2525// Rather than using doBlock logic to write one block at a time, this custom
    2626// doSegment method, writes the entire segment with a single write call.
    27 void StdOutKernel::generateDoSegmentMethod() {
     27void StdOutKernel::generateDoSegmentMethod() const {
    2828    auto savePoint = iBuilder->saveIP();
    2929    Module * m = iBuilder->getModule();
     
    3434    BasicBlock * setTermination = BasicBlock::Create(iBuilder->getContext(), "setTermination", doSegmentFunction, 0);
    3535    BasicBlock * stdOutexit = BasicBlock::Create(iBuilder->getContext(), "stdOutexit", doSegmentFunction, 0);
    36     Constant * blockItems = ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getBitBlockWidth());
    37     Constant * itemBytes = ConstantInt::get(iBuilder->getSizeTy(), mCodeUnitWidth/8);
     36    Constant * blockItems = iBuilder->getSize(iBuilder->getBitBlockWidth());
     37    Constant * itemBytes = iBuilder->getSize(mCodeUnitWidth/8);
    3838   
    3939    Function::arg_iterator args = doSegmentFunction->arg_begin();
     
    8080}
    8181
    82 void StdOutKernel::generateFinalBlockMethod() {
     82void StdOutKernel::generateFinalBlockMethod() const {
    8383    auto savePoint = iBuilder->saveIP();
    8484    Module * m = iBuilder->getModule();
     
    8787   
    8888    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "fb_flush", finalBlockFunction, 0));
    89     Constant * blockItems = ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getBitBlockWidth());
    90     Constant * itemBytes = ConstantInt::get(iBuilder->getSizeTy(), mCodeUnitWidth/8);
     89    Constant * blockItems = iBuilder->getSize(iBuilder->getBitBlockWidth());
     90    Constant * itemBytes = iBuilder->getSize(mCodeUnitWidth/8);
    9191    Value * self = getParameter(finalBlockFunction, "self");
    9292    Value * streamStructPtr = getStreamSetStructPtr(self, "codeUnitBuffer");
Note: See TracChangeset for help on using the changeset viewer.