Changeset 5073


Ignore:
Timestamp:
Jun 24, 2016, 6:14:28 PM (3 years ago)
Author:
cameron
Message:

Module names include BitBlockTypeName?

Location:
icGREP/icgrep-devel/icgrep
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.cpp

    r5026 r5073  
    66
    77#include "idisa_builder.h"
     8#include <string>
    89#include <llvm/IR/IRBuilder.h>
    910#include <llvm/IR/Constants.h>
     
    2425}
    2526
    26 
     27std::string IDISA_Builder::getBitBlockTypeName() {
     28    if (mBitBlockType->isIntegerTy()) return "i" + std::to_string(mBitBlockWidth);
     29    assert(mBitBlockType->isVectorType() || "BitBlockType is neither integer nor vector");
     30    unsigned fw = mBitBlockType->getScalarSizeInBits();
     31    return "v" + std::to_string(mBitBlockWidth/fw) + "i" + std::to_string(fw);
     32}
     33
     34   
    2735static Function * create_printf(Module * const mod) {
    2836    Function * printf = mod->getFunction("printf");
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h

    r5059 r5073  
    3636        return mBitBlockType;
    3737    }
     38
     39    std::string getBitBlockTypeName();  // A short string such as v4i64 or i256.
    3840
    3941    Value * bitCast(Value * a) {
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5063 r5073  
    5050    IDISA::IDISA_Builder::InsertPoint savePoint = iBuilder->saveIP();
    5151    if (mKernelStateType == nullptr) finalizeKernelStateType();
    52     std::unique_ptr<Module> theModule = make_unique<Module>(mKernelName, getGlobalContext());
     52    std::unique_ptr<Module> theModule = make_unique<Module>(mKernelName + "_" + iBuilder->getBitBlockTypeName(), getGlobalContext());
    5353    Module * m = theModule.get();
    5454    iBuilder->setModule(m);
    55     generateKernel();
     55    KernelBuilder::generateKernel();
    5656    iBuilder->setModule(saveModule);
    5757    iBuilder->restoreIP(savePoint);
Note: See TracChangeset for help on using the changeset viewer.