Changeset 4943


Ignore:
Timestamp:
Feb 26, 2016, 2:26:07 PM (3 years ago)
Author:
lindanl
Message:

format register printing.

File:
1 edited

Legend:

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

    r4942 r4943  
    2323}
    2424
    25 // void IDISA_Builder::genPrintRegister(std::string regName, Value * bitblockValue) {
    26 //     if (mPrintRegisterFunction == nullptr) {
    27 //         mPrintRegisterFunction = mMod->getOrInsertFunction("wrapped_print_register", Type::getVoidTy(mMod->getContext()), Type::getInt8PtrTy(mMod->getContext()), mBitBlockType, NULL);
    28 //     }
    29 //     Constant * regNameData = ConstantDataArray::getString(mMod->getContext(), regName);
    30 //     GlobalVariable *regStrVar = new GlobalVariable(*mMod,
    31 //                                                    ArrayType::get(IntegerType::get(mMod->getContext(), 8), regName.length()+1),
    32 //                                                    /*isConstant=*/ true,
    33 //                                                    /*Linkage=*/ GlobalValue::PrivateLinkage,
    34 //                                                    /*Initializer=*/ regNameData);
    35 //     Value * regStrPtr = CreateGEP(regStrVar, std::vector<Value *>({getInt64(0), getInt32(0)}));
    36 //     CreateCall(mPrintRegisterFunction, std::vector<Value *>({regStrPtr, bitCast(bitblockValue)}));
    37 // }
    3825
    3926Constant* geti8StrVal(Module& M, char const* str, Twine const& name) {
     
    6451    Value * val = CreateBitCast(bitblockValue, printType);
    6552    std::vector<Value *> args;
    66     std::string str = regName + "\t = %02X";
    67     for(unsigned int i=0; i<mBitBlockWidth/8-1; i++)
    68         str += ", %02X";
     53    std::string str = regName;
     54    for (unsigned int i = 0; i < 40 - regName.length(); i++) str += " ";
     55    str += "= %02X";
     56    for (unsigned int i=0; i<mBitBlockWidth/8-1; i++)
     57        str += " %02X";
    6958    str += "\n";
    7059    args.push_back(geti8StrVal(*mMod, str.c_str(), regName));
Note: See TracChangeset for help on using the changeset viewer.