Ignore:
Timestamp:
Mar 22, 2016, 5:14:05 PM (3 years ago)
Author:
nmedfort
Message:

First attempt at dynamic segment size intergration.

File:
1 edited

Legend:

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

    r4974 r4986  
    8181}
    8282
     83void IDISA_Builder::CallPrintInt(const std::string & name, Value * const value) {
     84    Constant * printRegister = mMod->getFunction("PrintInt");
     85    if (LLVM_UNLIKELY(printRegister == nullptr)) {
     86        FunctionType *FT = FunctionType::get(getVoidTy(), { PointerType::get(getInt8Ty(), 0), getInt64Ty() }, false);
     87        Function * function = Function::Create(FT, Function::InternalLinkage, "PrintInt", mMod);
     88        auto arg = function->arg_begin();
     89        std::string out = "%-40s = %i\n";
     90        BasicBlock * entry = BasicBlock::Create(mMod->getContext(), "entry", function);
     91        IRBuilder<> builder(entry);
     92        std::vector<Value *> args;
     93        args.push_back(geti8StrVal(*mMod, out.c_str(), ""));
     94        Value * const name = arg++;
     95        name->setName("name");
     96        args.push_back(name);
     97        Value * value = arg;
     98        value->setName("value");
     99        args.push_back(value);
     100        builder.CreateCall(create_printf(mMod), args);
     101        builder.CreateRetVoid();
     102
     103        printRegister = function;
     104    }
     105    CreateCall2(printRegister, geti8StrVal(*mMod, name.c_str(), name), CreateBitCast(value, getInt64Ty()));
     106}
     107
    83108Constant * IDISA_Builder::simd_himask(unsigned fw) {
    84109    return Constant::getIntegerValue(getIntNTy(mBitBlockWidth), APInt::getSplat(mBitBlockWidth, APInt::getHighBitsSet(fw, fw/2)));
Note: See TracChangeset for help on using the changeset viewer.