Changeset 4824


Ignore:
Timestamp:
Oct 5, 2015, 9:24:39 PM (2 years ago)
Author:
cameron
Message:

Generating carry data initialization routine

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4821 r4824  
    4242       
    4343    }
     44   
     45void CarryManager::generateCarryDataInitializer(Module * m) {
     46    FunctionType * functionType = FunctionType::get(Type::getVoidTy(m->getContext()), std::vector<Type *>({}), false);
     47    SmallVector<AttributeSet, 1> Attrs;
     48    Attrs.push_back(AttributeSet::get(m->getContext(), ~0U, std::vector<Attribute::AttrKind>({ Attribute::NoUnwind, Attribute::UWTable })));
     49    AttributeSet AttrSet = AttributeSet::get(m->getContext(), Attrs);
     50   
     51    // Create the function that will be generated.
     52    Function * f = Function::Create(functionType, GlobalValue::ExternalLinkage, "process_block_initialize_carries", m);
     53    f->setCallingConv(CallingConv::C);
     54    f->setAttributes(AttrSet);
     55    llvm::IRBuilderBase::InsertPoint ip = mBuilder->saveIP();
     56    mBuilder->SetInsertPoint(BasicBlock::Create(m->getContext(), "entry", f,0));
     57    mBuilder->CreateMemSet(mCarryBitBlockPtr, mBuilder->getInt8(0), mTotalCarryDataBitBlocks * BLOCK_SIZE, BLOCK_SIZE/8);
     58    ReturnInst::Create(m->getContext(), mBuilder->GetInsertBlock());
     59    mBuilder->restoreIP(ip);
     60}
     61   
     62   
    4463
    4564void CarryManager::initialize(Module * m, PabloBlock * pb) {
     
    83102    mCarryPackBasePtr = mBuilder->CreateBitCast(cdArray, PointerType::get(mCarryPackType, 0));
    84103    mCarryBitBlockPtr = mBuilder->CreateBitCast(cdArray, PointerType::get(mBitBlockType, 0));
     104   
     105    generateCarryDataInitializer(m);
    85106   
    86107    // Popcount data is stored after all the carry data.
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.h

    r4821 r4824  
    6666   
    6767    void initialize(Module * m, PabloBlock * blk);
     68   
     69    void generateCarryDataInitializer(Module * m);
    6870   
    6971    unsigned enumerate(PabloBlock * blk, unsigned ifDepth, unsigned whileDepth);
Note: See TracChangeset for help on using the changeset viewer.