Ignore:
Timestamp:
Aug 26, 2015, 1:41:38 PM (4 years ago)
Author:
cameron
Message:

Clean ups for compilation with gcc 4.8

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

Legend:

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

    r4717 r4750  
    7676void PabloBlockCarryData::dumpCarryData(llvm::raw_ostream & strm) {
    7777    unsigned totalDepth = ifDepth + whileDepth;
    78     for (int i = 0; i < totalDepth; i++) strm << "  ";
     78    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    7979    strm << "scope index = " << theScope->getScopeIndex();
    8080    strm << " framePosition: " << framePosition << ", ifDepth: " << ifDepth << ", whileDepth:" << whileDepth << ", maxNestingDepth: " << maxNestingDepth << "\n";
    81     for (int i = 0; i < totalDepth; i++) strm << "  ";
     81    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    8282    strm << "longAdvance: offset = " << longAdvance.frameOffset << ", entries = " << longAdvance.entries << "\n";
    83     for (int i = 0; i < totalDepth; i++) strm << "  ";
     83    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    8484    strm << "shortAdvance: offset = " << shortAdvance.frameOffset << ", entries = " << shortAdvance.entries << "\n";
    85     for (int i = 0; i < totalDepth; i++) strm << "  ";
     85    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    8686    strm << "advance1: offset = " << advance1.frameOffset << ", entries = " << advance1.entries << "\n";
    87     for (int i = 0; i < totalDepth; i++) strm << "  ";
     87    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    8888    strm << "addWithCarry: offset = " << addWithCarry.frameOffset << ", entries = " << addWithCarry.entries << "\n";
    89     for (int i = 0; i < totalDepth; i++) strm << "  ";
     89    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    9090    strm << "nested: offset = " << nested.frameOffset << ", allocatedBits = " << nested.allocatedBits << "\n";
    91     for (int i = 0; i < totalDepth; i++) strm << "  ";
     91    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    9292    strm << "summary: offset = " << summary.frameOffset << "\n";
    93     for (int i = 0; i < totalDepth; i++) strm << "  ";
     93    for (unsigned i = 0; i < totalDepth; i++) strm << "  ";
    9494    strm << "scopeCarryDataSize = " << scopeCarryDataSize  << "\n";
    9595    strm.flush();
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4733 r4750  
    6666    mCarryInPack.resize(totalPackCount);
    6767    mCarryOutPack.resize(totalPackCount);
    68     for (auto i = 0; i < totalPackCount; i++) mCarryInPack[i]=nullptr;
     68    for (unsigned i = 0; i < totalPackCount; i++) mCarryInPack[i]=nullptr;
    6969
    7070    if (Strategy == SequentialFullyPackedStrategy) {
     
    338338    }
    339339    else {
    340         Value * carry_bit = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_out_strm, mBuilder->getIntNTy(BLOCK_SIZE)), 127);
     340        Value * carry_bit = mBuilder->CreateLShr(mBuilder->CreateBitCast(carry_out_strm, mBuilder->getIntNTy(BLOCK_SIZE)), BLOCK_SIZE-1);
    341341        mCarryOutPack[posn] = mBuilder->CreateBitCast(carry_bit, mBitBlockType);
    342342        if (mCarryInfo->getWhileDepth() == 0) {
     
    352352
    353353Value * CarryManager::addCarryInCarryOut(int localIndex, Value* e1, Value* e2) {
     354#if (BLOCK_SIZE == 128)
    354355    Value * carryq_value = getCarryOpCarryIn(localIndex);
    355     #if (BLOCK_SIZE == 128)
    356356    //calculate carry through logical ops
    357357    Value* carrygen = mBuilder->CreateAnd(e1, e2, "carrygen");
     
    363363    Value* sum = mBuilder->CreateAdd(partial, mBuilder->CreateBitCast(mid_carry_in, mBitBlockType), "sum");
    364364    Value* carry_out_strm = mBuilder->CreateOr(carrygen, mBuilder->CreateAnd(carryprop, mBuilder->CreateNot(sum)));
    365 
    366     #else
    367     //BLOCK_SIZE == 256, there is no other implementation
    368     static_assert(false, "Add with carry for 256-bit bitblock requires USE_UADD_OVERFLOW");
    369     #endif         
    370365    setCarryOpCarryOut(localIndex, carry_out_strm);
    371366    return sum;
    372 }
    373 
    374 
    375 Value * CarryManager::advanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm) {
     367#else
     368    //BLOCK_SIZE == 256, there is no other implementation
     369    Value * carryq_value = getCarryOpCarryIn(localIndex);
     370    Value* carrygen = mBuilder->CreateAnd(e1, e2, "carrygen");
     371    Value* carryprop = mBuilder->CreateOr(e1, e2, "carryprop");
     372    Value * sum = iBuilder->simd_add(BLOCK_SIZE, iBuilder->simd_add(BLOCK_SIZE, e1, e2), carryq_value);
     373    Value* carry_out_strm = mBuilder->CreateOr(carrygen, mBuilder->CreateAnd(carryprop, mBuilder->CreateNot(sum)));
     374    setCarryOpCarryOut(localIndex, carry_out_strm);
     375    return sum;
     376#endif         
     377}
     378
     379
     380Value * CarryManager::advanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * strm) {
    376381    if (shift_amount == 1) {
    377382        return unitAdvanceCarryInCarryOut(localIndex, strm);
     
    415420}
    416421
    417 Value * CarryManager::shortAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm) {
     422Value * CarryManager::shortAdvanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * strm) {
    418423    unsigned posn = shortAdvancePosition(localIndex);
    419424    if (mITEMS_PER_PACK > 1) {// #ifdef PACKING
     
    456461
    457462   
    458 Value * CarryManager::longAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * carry_out) {
     463Value * CarryManager::longAdvanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * carry_out) {
    459464    unsigned carryDataIndex = longAdvanceBitBlockPosition(localIndex);
    460465    Value * advBaseIndex = mBuilder->getInt64(carryDataIndex);
     
    578583    }
    579584    else {
    580         auto localCarryIndex = localBasePack();
    581         auto localCarryPacks = mCarryInfo->getLocalCarryPackCount();
     585        unsigned localCarryIndex = localBasePack();
     586        unsigned localCarryPacks = mCarryInfo->getLocalCarryPackCount();
    582587        if (localCarryPacks > 0) {
    583588            carry_summary = mCarryOutPack[localCarryIndex];
    584             for (auto i = 1; i < localCarryPacks; i++) {
     589            for (unsigned i = 1; i < localCarryPacks; i++) {
    585590                carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[localCarryIndex+i]);
    586591            }
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.h

    r4726 r4750  
    8383
    8484
    85     Value * advanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm);
     85    Value * advanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * strm);
    8686 
    8787    /* Methods for getting and setting carry summary values for If statements */
     
    148148
    149149    Value * unitAdvanceCarryInCarryOut(int localIndex, Value * strm);
    150     Value * shortAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm);
    151     Value * longAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm);
     150    Value * shortAdvanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * strm);
     151    Value * longAdvanceCarryInCarryOut(int localIndex, unsigned shift_amount, Value * strm);
    152152   
    153153   
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.cpp

    r4723 r4750  
    9696    mUsers.clear();
    9797    assert (expr);
    98     for (auto i = 0; i != users; ++i) {
     98    for (Vector::size_type i = 0; i != users; ++i) {
    9999        user[i]->replaceUsesOfWith(this, expr);
    100100    }
     
    211211Statement * Statement::eraseFromParent(const bool recursively) {
    212212    // remove this statement from its operands' users list
    213     for (auto i = 0; i != mOperands; ++i) {
     213    for (unsigned i = 0; i != mOperands; ++i) {
    214214        mOperand[i]->removeUser(this);
    215215    }
     
    233233
    234234    if (recursively) {
    235         for (auto i = 0; i != mOperands; ++i) {
     235        for (unsigned i = 0; i != mOperands; ++i) {
    236236            PabloAST * const op = mOperand[i];
    237237            if (op->getNumUses() == 0 && isa<Statement>(op)) {
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4749 r4750  
    8888                                                   /*Linkage=*/ GlobalValue::PrivateLinkage,
    8989                                                   /*Initializer=*/ regNameData);
    90     Value * regStrPtr = mBuilder->CreateGEP(regStrVar, {mBuilder->getInt64(0), mBuilder->getInt32(0)});
    91     mBuilder->CreateCall(mPrintRegisterFunction, {regStrPtr, bitblockValue});
     90    Value * regStrPtr = mBuilder->CreateGEP(regStrVar, std::vector<Value *>({mBuilder->getInt64(0), mBuilder->getInt32(0)}));
     91    mBuilder->CreateCall(mPrintRegisterFunction, std::vector<Value *>({regStrPtr, bitblockValue}));
    9292}
    9393
     
    178178    mInputType = PointerType::get(StructType::get(mMod->getContext(), std::vector<Type *>(function.getNumOfParameters(), mBitBlockType)), 0);
    179179    Type * outputType = PointerType::get(StructType::get(mMod->getContext(), std::vector<Type *>(function.getNumOfResults(), mBitBlockType)), 0);
    180     FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), {{mInputType, outputType}}, false);
     180    FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), std::vector<Type *>({mInputType, outputType}), false);
    181181
    182182
    183183    //Starts on process_block
    184184    SmallVector<AttributeSet, 3> Attrs;
    185     Attrs.push_back(AttributeSet::get(mMod->getContext(), ~0U, { Attribute::NoUnwind, Attribute::UWTable }));
    186     Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, { Attribute::ReadOnly, Attribute::NoCapture }));
    187     Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, { Attribute::ReadNone, Attribute::NoCapture }));
     185    Attrs.push_back(AttributeSet::get(mMod->getContext(), ~0U, std::vector<Attribute::AttrKind>({ Attribute::NoUnwind, Attribute::UWTable })));
     186    Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, std::vector<Attribute::AttrKind>({ Attribute::ReadOnly, Attribute::NoCapture })));
     187    Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, std::vector<Attribute::AttrKind>({ Attribute::ReadNone, Attribute::NoCapture })));
    188188    AttributeSet AttrSet = AttributeSet::get(mMod->getContext(), Attrs);
    189189
     
    427427        //Starts on process_block
    428428        SmallVector<AttributeSet, 3> Attrs;
    429         Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, { Attribute::ReadOnly, Attribute::NoCapture }));
    430         Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, { Attribute::ReadNone, Attribute::NoCapture }));
     429        Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, std::vector<Attribute::AttrKind>({ Attribute::ReadOnly, Attribute::NoCapture })));
     430        Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, std::vector<Attribute::AttrKind>({ Attribute::ReadNone, Attribute::NoCapture })));
    431431        AttributeSet AttrSet = AttributeSet::get(mMod->getContext(), Attrs);
    432432
     
    440440        AllocaInst * outputStruct = mBuilder->CreateAlloca(outputType);
    441441        mBuilder->CreateCall2(externalFunction, mInputAddressPtr, outputStruct);
    442         Value * outputPtr = mBuilder->CreateGEP(outputStruct, { mBuilder->getInt32(0), mBuilder->getInt32(0) });
     442        Value * outputPtr = mBuilder->CreateGEP(outputStruct, std::vector<Value *>({ mBuilder->getInt32(0), mBuilder->getInt32(0) }));
    443443        expr = mBuilder->CreateAlignedLoad(outputPtr, BLOCK_SIZE / 8, false);
    444444    }
Note: See TracChangeset for help on using the changeset viewer.