Changeset 4726 for icGREP


Ignore:
Timestamp:
Aug 16, 2015, 3:55:50 PM (4 years ago)
Author:
cameron
Message:

Embed carry data in compiled LLVM module; eliminate passing of carry data pointers/size

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/do_grep.cpp

    r4659 r4726  
    133133    Basis_bits basis_bits;
    134134    BitBlock match_vector;
    135     BitBlock process_block_state_data[(mProcessBlockStateSize + sizeof(BitBlock) - 1)/sizeof(BitBlock)];   
    136135   
    137136    mFileName = infilename + ":";
     
    146145
    147146    match_vector = simd<1>::constant<0>();
    148     memset (process_block_state_data, 0, mProcessBlockStateSize);
    149147    int fdSrc;
    150148    struct stat infile_sb;
     
    196194            s2p_do_block((BytePack *) &mFileBuffer[block_base], basis_bits);
    197195            Output output;
    198             mProcessBlockFcn(basis_bits, process_block_state_data, output);
     196            mProcessBlockFcn(basis_bits, output);
    199197
    200198            mMatch_scanner.load_block(output.matches, blk);
     
    243241        s2p_do_block((BytePack *) &mFileBuffer[block_base], basis_bits);
    244242        Output output;
    245         mProcessBlockFcn(basis_bits, process_block_state_data, output);
     243        mProcessBlockFcn(basis_bits, output);
    246244
    247245        mLineBreak_scanner.load_block(output.LF, blk);
     
    287285   
    288286    Output output;
    289     mProcessBlockFcn(basis_bits, process_block_state_data, output);
     287    mProcessBlockFcn(basis_bits, output);
    290288
    291289    if (mCountOnlyOption)
  • icGREP/icgrep-devel/icgrep/do_grep.h

    r4660 r4726  
    3939
    4040
    41 typedef void (*process_block_fcn)(const Basis_bits & basis_bits, BitBlock process_block_state_data[], Output & output);
     41typedef void (*process_block_fcn)(const Basis_bits & basis_bits, Output & output);
    4242
    4343class GrepExecutor {
    4444public:
    4545
    46     GrepExecutor(size_t process_block_state_size, void * process_block)
     46    GrepExecutor(void * process_block)
    4747    : mCountOnlyOption(false)
    4848    , mShowFileNameOption(false)
    4949    , mShowLineNumberingOption(false)
    50     , mProcessBlockStateSize(process_block_state_size)
    5150    , mProcessBlockFcn(reinterpret_cast<process_block_fcn>(process_block)) {
    5251
     
    6867    bool mNormalizeLineBreaksOption;
    6968
    70     size_t mProcessBlockStateSize;
    7169    process_block_fcn mProcessBlockFcn;
    7270   
  • icGREP/icgrep-devel/icgrep/generate_predefined_ucd_functions.cpp

    r4724 r4726  
    7474#endif
    7575
    76 using property_list = std::vector<std::pair<std::string, size_t>>;
     76using property_list = std::vector<std::string>;
    7777
    7878/** ------------------------------------------------------------------------------------------------------------- *
     
    219219 * @brief compileUnicodeSet
    220220 ** ------------------------------------------------------------------------------------------------------------- */
    221 size_t compileUnicodeSet(std::string name, const UnicodeSet & set, PabloCompiler & pc, Module * module) {
     221void compileUnicodeSet(std::string name, const UnicodeSet & set, PabloCompiler & pc, Module * module) {
    222222    #ifdef ENABLE_MULTIPLEXING
    223223    if (MultiplexingDistributionFile) {
     
    265265    auto func = pc.compile(function, module);
    266266    releaseSlabAllocatorMemory();
    267 
     267/*
    268268    if (LongestDependenceChainFile) {
    269269        const auto pablo_metrix = computePabloDependencyChainMetrics(function);
     
    272272        (*LongestDependenceChainFile) << ',' << llvm_metrix.first << ',' << llvm_metrix.second << '\n';
    273273    }
    274 
    275     return func.second;
     274*/
    276275}
    277276
     
    302301    header << "#include <tuple>\n";
    303302    header << "namespace UCD {\n\n";
    304     header << "using ExternalProperty = std::tuple<void *, unsigned, unsigned, size_t>;\n\n";
     303    header << "using ExternalProperty = std::tuple<void *, unsigned, unsigned>;\n\n";
    305304    header << "const ExternalProperty & resolveExternalProperty(const std::string & name);\n\n";
    306305    header << "}\n\n";
     
    329328    cpp << "struct Output {\n    BitBlock bit[1];\n};\n\n";
    330329    for (auto prop : properties) {
    331         cpp << "extern \"C\" void " + prop.first + "(const Input &, BitBlock *, Output &);\n";
     330        cpp << "extern \"C\" void " + prop + "(const Input &, Output &);\n";
    332331    }
    333332
    334333    cpp << "\nconst static std::unordered_map<std::string, ExternalProperty> EXTERNAL_UCD_PROPERTY_MAP = {\n";
    335334    for (auto itr = properties.begin(); itr != properties.end(); ) {
    336         cpp << "    {\"" + itr->first + "\", std::make_tuple(reinterpret_cast<void *>(&" + itr->first + "), 8, 1, " + std::to_string(itr->second) + ")}";
     335        cpp << "    {\"" + *itr + "\", std::make_tuple(reinterpret_cast<void *>(&" + *itr + "), 8, 1)}";
    337336        if (++itr != properties.end()) {
    338337            cpp << ",";
     
    367366                const UnicodeSet & set = enumObj->GetCodepointSet(canonicalize_value_name(value));
    368367                std::string name = "__get_" + property_enum_name[enumObj->getPropertyCode()] + "_" + value;
    369                 properties.emplace_back(name, compileUnicodeSet(name, set, pc, module));
     368                compileUnicodeSet(name, set, pc, module);
     369                properties.emplace_back(name);
    370370            }
    371371        }
     
    374374                const UnicodeSet & set = extObj->GetCodepointSet(canonicalize_value_name(value));
    375375                std::string name = "__get_" + property_enum_name[extObj->getPropertyCode()] + "_" + value;
    376                 properties.emplace_back(name, compileUnicodeSet(name, set, pc, module));
     376                compileUnicodeSet(name, set, pc, module);
     377                properties.emplace_back(name);
    377378            }
    378379        }
     
    380381            const UnicodeSet & set = binObj->GetCodepointSet(Binary_ns::Y);
    381382            std::string name = "__get_" + property_enum_name[binObj->getPropertyCode()] + "_Y";
    382             properties.emplace_back(name, compileUnicodeSet(name, set, pc, module));
     383            compileUnicodeSet(name, set, pc, module);
     384            properties.emplace_back(name);
    383385        }
    384386    }
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r4659 r4726  
    108108    const auto llvm_codegen = icgrep::compile(encoding, regexVector, globalFlags);
    109109    if (llvm_codegen.FunctionPointer) {
    110         GrepExecutor grepEngine = GrepExecutor(llvm_codegen.CarryDataSize, llvm_codegen.FunctionPointer);
     110        GrepExecutor grepEngine = GrepExecutor(llvm_codegen.FunctionPointer);
    111111        grepEngine.setCountOnlyOption(CountOnly);
    112112        grepEngine.setNormalizeLineBreaksOption(NormalizeLineBreaks);
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4722 r4726  
    1414#include <iostream>
    1515#include <llvm/Support/CommandLine.h>
     16#include <llvm/IR/BasicBlock.h>
     17#include <llvm/IR/CallingConv.h>
     18#include <llvm/IR/Function.h>
     19
    1620
    1721static cl::opt<CarryManagerStrategy> Strategy(cl::desc("Choose carry management strategy:"),
     
    3943    }
    4044
    41 unsigned CarryManager::initialize(PabloBlock * pb, Value * carryPtr) {
     45void CarryManager::initialize(Module * m, PabloBlock * pb) {
    4246    mPabloRoot = pb;
     47    unsigned scopeCount = doScopeCount(pb);
     48    mCarryInfoVector.resize(scopeCount);
     49    unsigned totalCarryDataSize = enumerate(pb, 0, 0);
     50   
     51    unsigned totalPackCount = (totalCarryDataSize + mITEMS_PER_PACK - 1)/mITEMS_PER_PACK;
     52
     53    mCarryPackPtr.resize(totalPackCount);
     54    mCarryInPack.resize(totalPackCount);
     55    mCarryOutPack.resize(totalPackCount);
     56    for (auto i = 0; i < totalPackCount; i++) mCarryInPack[i]=nullptr;
     57
    4358    if (Strategy == SequentialFullyPackedStrategy) {
    4459        mPACK_SIZE = 64;
    4560        mITEMS_PER_PACK = 64;
    4661        mCarryPackType = mBuilder->getIntNTy(mPACK_SIZE);
    47         mCarryPackBasePtr = mBuilder->CreateBitCast(carryPtr, Type::getInt64PtrTy(mBuilder->getContext()));
    48         mCarryBitBlockPtr = carryPtr;
    4962        mZeroInitializer = mBuilder->getInt64(0);
    5063        mOneInitializer = mBuilder->getInt64(-1);
    51     }
    52     else { // if Strategy == BitBlockStrategy
     64        mTotalCarryDataBitBlocks = (totalCarryDataSize + BLOCK_SIZE - 1)/BLOCK_SIZE;
     65       
     66    }
     67    else {
    5368        mPACK_SIZE = BLOCK_SIZE;
    5469        mITEMS_PER_PACK = 1;
    5570        mCarryPackType = mBitBlockType;
    56         mCarryPackBasePtr = carryPtr;
    57         mCarryBitBlockPtr = mCarryPackBasePtr;
    58     }
    59     unsigned scopeCount = doScopeCount(pb);
    60     mCarryInfoVector.resize(scopeCount);
    61     unsigned totalCarryDataSize = enumerate(pb, 0, 0);
    62    
    63     unsigned totalPackCount = (totalCarryDataSize + mITEMS_PER_PACK - 1)/mITEMS_PER_PACK;
    64 
    65     mCarryPackPtr.resize(totalPackCount);
    66     mCarryInPack.resize(totalPackCount);
    67     mCarryOutPack.resize(totalPackCount);
    68     for (auto i = 0; i < totalPackCount; i++) mCarryInPack[i]=nullptr;
    69 
    70     if (Strategy == SequentialFullyPackedStrategy) {
    71         mTotalCarryDataBitBlocks = (totalCarryDataSize + BLOCK_SIZE - 1)/BLOCK_SIZE;
    72     }
    73     else {
    7471        mTotalCarryDataBitBlocks = totalCarryDataSize;
    7572    }
     73   
     74    ArrayType* cdArrayTy = ArrayType::get(mBitBlockType, mTotalCarryDataBitBlocks);
     75    GlobalVariable* cdArray = new GlobalVariable(*m, cdArrayTy, /*isConstant=*/false, GlobalValue::CommonLinkage, /*Initializer=*/0, "process_block_carry_data");
     76    cdArray->setAlignment(BLOCK_SIZE/8);
     77    ConstantAggregateZero* cdInitData = ConstantAggregateZero::get(cdArrayTy);
     78    cdArray->setInitializer(cdInitData);
     79   
     80    mCarryPackBasePtr = mBuilder->CreateBitCast(cdArray, PointerType::get(mCarryPackType, 0));
     81    mCarryBitBlockPtr = mBuilder->CreateBitCast(cdArray, PointerType::get(mBitBlockType, 0));
     82   
    7683    // Popcount data is stored after all the carry data.
    7784    if (mPabloCountCount > 0) {
    78         mPopcountBasePtr = mBuilder->CreateBitCast(mBuilder->CreateGEP(carryPtr, mBuilder->getInt64(mTotalCarryDataBitBlocks)), Type::getInt64PtrTy(mBuilder->getContext()));
    79         mTotalCarryDataBitBlocks += (mPabloCountCount + BLOCK_SIZE/64 - 1) * 64/BLOCK_SIZE;
     85        ArrayType* pcArrayTy = ArrayType::get(mBuilder->getIntNTy(64), mPabloCountCount);
     86        GlobalVariable* pcArray = new GlobalVariable(*m, pcArrayTy, /*isConstant=*/false, GlobalValue::CommonLinkage, 0, "popcount_data");
     87        cdArray->setAlignment(BLOCK_SIZE/8);
     88        ConstantAggregateZero* pcInitData = ConstantAggregateZero::get(pcArrayTy);
     89        pcArray->setInitializer(pcInitData);
     90        mPopcountBasePtr = mBuilder->CreateBitCast(pcArray, Type::getInt64PtrTy(mBuilder->getContext()));
    8091    }
    8192    // Carry Data area will have one extra bit block to store the block number.
    82     mBlockNoPtr = mBuilder->CreateBitCast(mBuilder->CreateGEP(carryPtr, mBuilder->getInt64(mTotalCarryDataBitBlocks)), Type::getInt64PtrTy(mBuilder->getContext()));
     93    GlobalVariable* blkNo = new GlobalVariable(*m, mBuilder->getIntNTy(64), /*isConstant=*/false, GlobalValue::CommonLinkage, 0, "blockNo");
     94    blkNo->setAlignment(8);
     95    blkNo->setInitializer(mBuilder->getInt64(0));
     96    mBlockNoPtr = blkNo;
    8397    mBlockNo = mBuilder->CreateLoad(mBlockNoPtr);
    8498    /*  Set the current scope to PabloRoot */
     
    86100    mCurrentFrameIndex = 0;
    87101    mCarryInfo = mCarryInfoVector[0];
    88     return mTotalCarryDataBitBlocks + 1; // One extra element for the block no.
    89102}
    90103   
     
    681694    return mBuilder->CreateBitCast(mBuilder->CreateZExt(countSoFar, mBuilder->getIntNTy(BLOCK_SIZE)), mBitBlockType);
    682695}
    683    
     696
    684697CarryManager::~CarryManager() {
    685698    for (auto * cd : mCarryInfoVector) {
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.h

    r4720 r4726  
    5757    , mPabloCountCount(0)
    5858    , mTotalCarryDataBitBlocks(0)
     59    , mCarryDataAllocationSize(0)
    5960    {
    6061
     
    6364    ~CarryManager();
    6465   
    65     unsigned initialize(PabloBlock * blk, Value * carryDataPtr); 
     66    void initialize(Module * m, PabloBlock * blk);
    6667   
    6768    unsigned enumerate(PabloBlock * blk, unsigned ifDepth, unsigned whileDepth);
     
    112113    Value * popCount(Value * to_count, unsigned globalIdx);
    113114   
     115    Value * declareCarryDataArray(Module * m);
     116
     117   
    114118private:
    115119    unsigned mPACK_SIZE;
     
    132136    unsigned mPabloCountCount; // Number of Pablo "Count" operations
    133137    unsigned mTotalCarryDataBitBlocks;
     138    unsigned mCarryDataAllocationSize;
    134139   
    135140    std::vector<PabloBlockCarryData *> mCarryInfoVector;
     
    168173    unsigned summaryPosition();
    169174    unsigned summaryBits();
    170 
    171175};
    172176
  • icGREP/icgrep-devel/icgrep/pablo/function.cpp

    r4692 r4726  
    55namespace pablo {
    66
    7 Prototype::Prototype(const PabloAST::ClassTypeId type, std::string && name, const unsigned numOfParameters, const unsigned numOfResults, const unsigned requiredStateSpace, void * functionPtr)
     7Prototype::Prototype(const PabloAST::ClassTypeId type, std::string && name, const unsigned numOfParameters, const unsigned numOfResults, void * functionPtr)
    88: PabloAST(type)
    99, mName(GlobalSymbolGenerator.get(name, false))
    1010, mNumOfParameters(numOfParameters)
    1111, mNumOfResults(numOfResults)
    12 , mRequiredStateSpace(requiredStateSpace)
    1312, mFunctionPtr(functionPtr) {
    1413
     
    1615
    1716PabloFunction::PabloFunction(std::string && name, const unsigned numOfParameters, const unsigned numOfResults)
    18 : Prototype(ClassTypeId::Function, std::move(name), numOfParameters, numOfResults, 0, nullptr)
     17: Prototype(ClassTypeId::Function, std::move(name), numOfParameters, numOfResults, nullptr)
    1918, mEntryBlock(PabloBlock::Create(mSymbolTable))
    2019, mParameters(reinterpret_cast<Var **>(mAllocator.allocate(sizeof(Var *) * numOfParameters)))
  • icGREP/icgrep-devel/icgrep/pablo/function.h

    r4692 r4726  
    2626    }
    2727
    28     static Prototype * Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults, const unsigned requiredStateSpace, void * functionPtr = nullptr);
     28    static Prototype * Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults, void * functionPtr = nullptr);
    2929
    3030    const String * getName() const {
     
    4040    }
    4141
    42     unsigned getRequiredStateSpace() const {
    43         return mRequiredStateSpace;
    44     }
    45 
    4642    void * getFunctionPtr() const {
    4743        return mFunctionPtr;
     
    4945
    5046protected:
    51     Prototype(const PabloAST::ClassTypeId type, std::string && name, const unsigned numOfParameters, const unsigned numOfResults, const unsigned requiredStateSpace, void * functionPtr);
     47    Prototype(const PabloAST::ClassTypeId type, std::string && name, const unsigned numOfParameters, const unsigned numOfResults, void * functionPtr);
    5248protected:
    5349    const String * const    mName;
    5450    const unsigned          mNumOfParameters;
    5551    const unsigned          mNumOfResults;
    56     unsigned                mRequiredStateSpace;
    5752    void *                  mFunctionPtr;
    5853};
    5954
    60 inline Prototype * Prototype::Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults, const unsigned requiredStateSpace, void * functionPtr) {
    61     return new Prototype(PabloAST::ClassTypeId::Prototype, std::move(name), numOfParameters, numOfResults, requiredStateSpace, functionPtr);
     55inline Prototype * Prototype::Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults, void * functionPtr) {
     56    return new Prototype(PabloAST::ClassTypeId::Prototype, std::move(name), numOfParameters, numOfResults, functionPtr);
    6257}
    6358
     
    143138    }
    144139
    145     void setRequiredStateSpace(const unsigned value) {
    146         mRequiredStateSpace = value;
    147     }
    148 
    149140    void setFunctionPtr(void * functionPtr) {
    150141        mFunctionPtr = functionPtr;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4720 r4726  
    7070, mBuilder(nullptr)
    7171, mCarryManager(nullptr)
    72 , mCarryOffset(0)
    7372, mBitBlockType(VectorType::get(IntegerType::get(getGlobalContext(), 64), BLOCK_SIZE / 64))
    7473, iBuilder(mBitBlockType)
     
    145144    mExecutionEngine = nullptr; // <-- pass ownership of the execution engine to the caller
    146145
    147     return CompiledPabloFunction(func.second, func.first, engine);
    148 }
    149 
    150 std::pair<llvm::Function *, size_t> PabloCompiler::compile(PabloFunction & function, Module * module) {
     146    return CompiledPabloFunction(func, engine);
     147}
     148
     149llvm::Function * PabloCompiler::compile(PabloFunction & function, Module * module) {
    151150
    152151 
    153     function.getEntryBlock().enumerateScopes(0);
     152    PabloBlock & mainScope = function.getEntryBlock();
     153
     154    mainScope.enumerateScopes(0);
    154155   
    155156    Examine(function);
     
    162163
    163164    mCarryManager = new CarryManager(mBuilder, mBitBlockType, mZeroInitializer, mOneInitializer, &iBuilder);
    164 
     165   
     166       
    165167    GenerateFunction(function);
    166168
     
    178180    }
    179181     
    180     PabloBlock & mainScope = function.getEntryBlock();
    181 
    182     mCarryOffset = mCarryManager->initialize(&mainScope, mCarryDataPtr);
    183    
    184182    //Generate the IR instructions for the function.
     183   
     184    mCarryManager->initialize(mMod, &mainScope);
    185185   
    186186    compileBlock(mainScope);
     
    204204    //Terminate the block
    205205    ReturnInst::Create(mMod->getContext(), mBuilder->GetInsertBlock());
     206   
    206207
    207208    // Clean up
     
    211212
    212213    //Return the required size of the carry data area to the process_block function.
    213     return std::make_pair(mFunction, mCarryOffset * sizeof(BitBlock));
     214    return mFunction;
    214215}
    215216
    216217inline void PabloCompiler::GenerateFunction(PabloFunction & function) {
    217218    mInputType = PointerType::get(StructType::get(mMod->getContext(), std::vector<Type *>(function.getNumOfParameters(), mBitBlockType)), 0);
    218     Type * carryType = PointerType::get(mBitBlockType, 0);
    219219    Type * outputType = PointerType::get(StructType::get(mMod->getContext(), std::vector<Type *>(function.getNumOfResults(), mBitBlockType)), 0);
    220     FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), {{mInputType, carryType, outputType}}, false);
     220    FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), {{mInputType, outputType}}, false);
    221221
    222222#ifdef USE_UADD_OVERFLOW
     
    304304
    305305    //Starts on process_block
    306     SmallVector<AttributeSet, 4> Attrs;
     306    SmallVector<AttributeSet, 3> Attrs;
    307307    Attrs.push_back(AttributeSet::get(mMod->getContext(), ~0U, { Attribute::NoUnwind, Attribute::UWTable }));
    308308    Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, { Attribute::ReadOnly, Attribute::NoCapture }));
    309     Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, { Attribute::NoCapture }));
    310     Attrs.push_back(AttributeSet::get(mMod->getContext(), 3U, { Attribute::ReadNone, Attribute::NoCapture }));
     309    Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, { Attribute::ReadNone, Attribute::NoCapture }));
    311310    AttributeSet AttrSet = AttributeSet::get(mMod->getContext(), Attrs);
    312311
     
    319318    mInputAddressPtr = args++;
    320319    mInputAddressPtr->setName("input");
    321     mCarryDataPtr = args++;
    322     mCarryDataPtr->setName("carry");
    323320    mOutputAddressPtr = args++;
    324321    mOutputAddressPtr->setName("output");
     
    550547
    551548        Type * inputType = StructType::get(mMod->getContext(), std::vector<Type *>{proto->getNumOfParameters(), mBitBlockType});
    552         Type * carryType = mBitBlockType;
    553549        Type * outputType = StructType::get(mMod->getContext(), std::vector<Type *>{proto->getNumOfResults(), mBitBlockType});
    554         FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), std::vector<Type *>{PointerType::get(inputType, 0), PointerType::get(carryType, 0), PointerType::get(outputType, 0)}, false);
     550        FunctionType * functionType = FunctionType::get(Type::getVoidTy(mMod->getContext()), std::vector<Type *>{PointerType::get(inputType, 0), PointerType::get(outputType, 0)}, false);
    555551
    556552        //Starts on process_block
    557553        SmallVector<AttributeSet, 3> Attrs;
    558554        Attrs.push_back(AttributeSet::get(mMod->getContext(), 1U, { Attribute::ReadOnly, Attribute::NoCapture }));
    559         Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, { Attribute::NoCapture }));
    560         Attrs.push_back(AttributeSet::get(mMod->getContext(), 3U, { Attribute::ReadNone, Attribute::NoCapture }));
     555        Attrs.push_back(AttributeSet::get(mMod->getContext(), 2U, { Attribute::ReadNone, Attribute::NoCapture }));
    561556        AttributeSet AttrSet = AttributeSet::get(mMod->getContext(), Attrs);
    562557
     
    569564        if (mExecutionEngine) mExecutionEngine->addGlobalMapping(externalFunction, proto->getFunctionPtr());
    570565
    571         // add mCarryOffset to mCarryDataPtr
    572         Value * carryFramePtr = mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(mCarryOffset));
    573566        AllocaInst * outputStruct = mBuilder->CreateAlloca(outputType);
    574         mBuilder->CreateCall3(externalFunction, mInputAddressPtr, carryFramePtr, outputStruct);
     567        mBuilder->CreateCall2(externalFunction, mInputAddressPtr, outputStruct);
    575568        Value * outputPtr = mBuilder->CreateGEP(outputStruct, { mBuilder->getInt32(0), mBuilder->getInt32(0) });
    576569        expr = mBuilder->CreateAlignedLoad(outputPtr, BLOCK_SIZE / 8, false);
    577 
    578         mCarryOffset += (proto->getRequiredStateSpace() + (BLOCK_SIZE / 8) - 1) / (BLOCK_SIZE / 8);
    579570    }
    580571    else if (const And * pablo_and = dyn_cast<And>(stmt)) {
     
    814805}
    815806
    816 CompiledPabloFunction::CompiledPabloFunction(size_t carryDataSize, Function * function, ExecutionEngine * executionEngine)
    817 : CarryDataSize(carryDataSize)
    818 , FunctionPointer(executionEngine->getPointerToFunction(function))
     807CompiledPabloFunction::CompiledPabloFunction(Function * function, ExecutionEngine * executionEngine)
     808: FunctionPointer(executionEngine->getPointerToFunction(function))
    819809, mFunction(function)
    820810, mExecutionEngine(executionEngine)
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h

    r4686 r4726  
    5858
    5959struct CompiledPabloFunction {
    60     const size_t        CarryDataSize;
    6160    void * const        FunctionPointer;
    6261private:
     
    6463    ExecutionEngine *   mExecutionEngine;
    6564public:
    66     CompiledPabloFunction(size_t carryDataSize, Function * function, ExecutionEngine * executionEngine);
     65    CompiledPabloFunction(Function * function, ExecutionEngine * executionEngine);
    6766
    6867    inline Function * getLLVMFunction() const {
     
    7574
    7675    inline CompiledPabloFunction(CompiledPabloFunction && cpf)
    77     : CarryDataSize(cpf.CarryDataSize)
    78     , FunctionPointer(cpf.FunctionPointer)
     76    : FunctionPointer(cpf.FunctionPointer)
    7977    , mFunction(cpf.mFunction)
    8078    , mExecutionEngine(cpf.mExecutionEngine)
     
    107105    ~PabloCompiler();
    108106    CompiledPabloFunction compile(pablo::PabloFunction & function);
    109     std::pair<Function *, size_t> compile(pablo::PabloFunction & function, Module *module);
     107    Function * compile(pablo::PabloFunction & function, Module *module);
    110108    Module *getModule();
    111109private:
     
    152150
    153151    CarryManager *                      mCarryManager;
    154     size_t                              mCarryOffset;
    155152
    156153    VectorType* const                   mBitBlockType;
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4717 r4726  
    284284        } else {
    285285            const UCD::ExternalProperty & ep = UCD::resolveExternalProperty(name->getFunctionName());
    286             var = pb.createCall(Prototype::Create(name->getFunctionName(), std::get<1>(ep), std::get<2>(ep), std::get<3>(ep), std::get<0>(ep)), mCCCompiler.getBasisBits());
     286            var = pb.createCall(Prototype::Create(name->getFunctionName(), std::get<1>(ep), std::get<2>(ep), std::get<0>(ep)), mCCCompiler.getBasisBits());
    287287        }
    288288        #endif
Note: See TracChangeset for help on using the changeset viewer.