Changeset 4816


Ignore:
Timestamp:
Oct 3, 2015, 8:10:17 PM (2 years ago)
Author:
cameron
Message:

Clean ups

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

Legend:

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

    r4750 r4816  
    1212#include <pablo/codegenstate.h>
    1313#include <pablo/carry_data.h>
     14#include <llvm/IR/Constants.h>
     15
    1416
    1517/*
     
    3840public:
    3941 
    40     CarryManager(IRBuilder <> * b, VectorType * bitBlockType, ConstantAggregateZero * zero, Constant * one, IDISA::IDISA_Builder * idb)
     42    CarryManager(IRBuilder <> * b, VectorType * bitBlockType, ConstantAggregateZero * zero, IDISA::IDISA_Builder * idb)
    4143    : mPACK_SIZE(BLOCK_SIZE)
    4244    , mITEMS_PER_PACK(1)
     
    4446    , mBitBlockType(bitBlockType)
    4547    , mZeroInitializer(zero)
    46     , mOneInitializer(one)
     48    , mOneInitializer(ConstantVector::getAllOnesValue(bitBlockType))
    4749    , iBuilder(idb)
    4850    , mPabloRoot(nullptr)
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4811 r4816  
    2424#include <llvm/IR/BasicBlock.h>
    2525#include <llvm/IR/CallingConv.h>
    26 #include <llvm/IR/Constants.h>
    2726#include <llvm/IR/DataLayout.h>
    2827#include <llvm/IR/DerivedTypes.h>
     
    6463, iBuilder(mBitBlockType)
    6564, mInputType(nullptr)
    66 , mCarryDataPtr(nullptr)
    6765, mWhileDepth(0)
    6866, mIfDepth(0)
     
    122120    iBuilder.initialize(mMod, mBuilder);
    123121
    124     mCarryManager = new CarryManager(mBuilder, mBitBlockType, mZeroInitializer, mOneInitializer, &iBuilder);
     122    mCarryManager = new CarryManager(mBuilder, mBitBlockType, mZeroInitializer, &iBuilder);
    125123   
    126124    if (DumpTrace) DeclareDebugFunctions();
     
    455453        Value* ifMask = compileExpression(sel->getCondition());
    456454        Value* ifTrue = mBuilder->CreateAnd(ifMask, compileExpression(sel->getTrueExpr()));
    457         Value* ifFalse = mBuilder->CreateAnd(genNot(ifMask), compileExpression(sel->getFalseExpr()));
     455        Value* ifFalse = mBuilder->CreateAnd(mBuilder->CreateNot(ifMask), compileExpression(sel->getFalseExpr()));
    458456        expr = mBuilder->CreateOr(ifTrue, ifFalse);
    459457    }
    460458    else if (const Not * pablo_not = dyn_cast<Not>(stmt)) {
    461         expr = genNot(compileExpression(pablo_not->getExpr()));
     459        expr = mBuilder->CreateNot(compileExpression(pablo_not->getExpr()));
    462460    }
    463461    else if (const Advance * adv = dyn_cast<Advance>(stmt)) {
     
    492490        unsigned carry_index = sthru->getLocalCarryIndex();
    493491        Value * sum = mCarryManager->addCarryInCarryOut(carry_index, marker_expr, cc_expr);
    494         expr = mBuilder->CreateAnd(sum, genNot(cc_expr), "scanthru");
     492        expr = mBuilder->CreateAnd(sum, mBuilder->CreateNot(cc_expr), "scanthru");
    495493    }
    496494    else if (const Mod64ScanThru * sthru = dyn_cast<Mod64ScanThru>(stmt)) {
     
    498496        Value * cc_expr = compileExpression(sthru->getScanThru());
    499497        Value * sum = iBuilder.simd_add(64, marker_expr, cc_expr);
    500         expr = mBuilder->CreateAnd(sum, genNot(cc_expr), "scanthru64");
     498        expr = mBuilder->CreateAnd(sum, mBuilder->CreateNot(cc_expr), "scanthru64");
    501499    }
    502500    else if (const Count * c = dyn_cast<Count>(stmt)) {
     
    536534}
    537535
    538 Value* PabloCompiler::genShiftLeft64(Value* e, const Twine &namehint) {
    539     Value* i128_val = mBuilder->CreateBitCast(e, mBuilder->getIntNTy(BLOCK_SIZE));
    540     return mBuilder->CreateBitCast(mBuilder->CreateShl(i128_val, 64, namehint), mBitBlockType);
    541 }
    542 
    543 inline Value* PabloCompiler::genNot(Value* expr) {
    544     return mBuilder->CreateXor(expr, mOneInitializer, "not");
    545 }
    546    
    547536void PabloCompiler::SetOutputValue(Value * marker, const unsigned index) {
    548537    if (LLVM_UNLIKELY(marker == nullptr)) {
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h

    r4734 r4816  
    9494    void compileWhile(const While * whileStmt);
    9595    Value* compileExpression(const PabloAST * expr);
    96     Value* genAddWithCarry(Value* e1, Value* e2, unsigned localIndex);
    97     Value* genUnitAdvanceWithCarry(Value* e1, unsigned localIndex);
    98     Value* genShortAdvanceWithCarry(Value* e1, unsigned localIndex, int shift_amount);
    99     Value* genLongAdvanceWithCarry(Value* e1, unsigned localIndex, int shift_amount);
    100     Value* genShiftHighbitToLow(unsigned FieldWidth, Value * op);
    101     Value* genShiftLeft64(Value* e, const Twine & namehint = "") ;
    102     Value* genNot(Value* expr);
    10396
    10497    #ifdef USE_UADD_OVERFLOW
     
    128121    PabloBlock *                        mPabloBlock;
    129122   
    130     Value*                              mCarryDataPtr;
    131123    unsigned                            mWhileDepth;
    132124    unsigned                            mIfDepth;
Note: See TracChangeset for help on using the changeset viewer.