Ignore:
Timestamp:
Jan 31, 2017, 4:08:11 PM (2 years ago)
Author:
nmedfort
Message:

Removed 'function' and 'self' parameters from generateXXXMethod() functions.

Location:
icGREP/icgrep-devel/icgrep/editd
Files:
7 edited

Legend:

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

    r5267 r5292  
    206206
    207207
    208 Function * editdPipeline(Module * mMod, IDISA::IDISA_Builder * iBuilder, const std::vector<std::string> & patterns) {
    209    
    210     Type * const size_ty = iBuilder->getSizeTy();
     208Function * editdPipeline(Module * m, IDISA::IDISA_Builder * iBuilder, const std::vector<std::string> & patterns) {
     209   
     210    Type * const sizeTy = iBuilder->getSizeTy();
    211211    Type * const voidTy = iBuilder->getVoidTy();
    212212    Type * const inputType = PointerType::get(ArrayType::get(ArrayType::get(iBuilder->getBitBlockType(), 8), 1), 0);
    213213   
    214     Function * const main = cast<Function>(mMod->getOrInsertFunction("Main", voidTy, inputType, size_ty, nullptr));
     214    Function * const main = cast<Function>(m->getOrInsertFunction("Main", voidTy, inputType, sizeTy, nullptr));
    215215    main->setCallingConv(CallingConv::C);
    216216    Function::arg_iterator args = main->arg_begin();
     
    237237    std::unique_ptr<Module> scanM = editdScanK.createKernelModule({&MatchResults}, {});               
    238238   
    239     mmapK.addKernelDeclarations(mMod);
    240     editdk.addKernelDeclarations(mMod);
    241     editdScanK.addKernelDeclarations(mMod);
    242 
    243     iBuilder->SetInsertPoint(BasicBlock::Create(mMod->getContext(), "entry", main,0));
     239    mmapK.addKernelDeclarations(m);
     240    editdk.addKernelDeclarations(m);
     241    editdScanK.addKernelDeclarations(m);
     242
     243    iBuilder->SetInsertPoint(BasicBlock::Create(m->getContext(), "entry", main,0));
    244244
    245245    ChStream.setStreamSetBuffer(inputStream, fileSize);
     
    250250    iBuilder->CreateRetVoid();
    251251   
    252     Linker L(*mMod);
     252    Linker L(*m);
    253253    L.linkInModule(std::move(mmapM));
    254254    L.linkInModule(std::move(editdM));
     
    277277}
    278278
    279 Function * preprocessPipeline(Module * mMod, IDISA::IDISA_Builder * iBuilder) {
     279Function * preprocessPipeline(Module * m, IDISA::IDISA_Builder * iBuilder) {
    280280    Type * mBitBlockType = iBuilder->getBitBlockType();
    281281   
     
    285285    Type * const outputType = PointerType::get(ArrayType::get(mBitBlockType, 4), 0);
    286286   
    287     Function * const main = cast<Function>(mMod->getOrInsertFunction("Main", voidTy, inputType, size_ty, outputType, nullptr));
     287    Function * const main = cast<Function>(m->getOrInsertFunction("Main", voidTy, inputType, size_ty, outputType, nullptr));
    288288    main->setCallingConv(CallingConv::C);
    289289    Function::arg_iterator args = main->arg_begin();
     
    313313    std::unique_ptr<Module> cccM = ccck.createKernelModule({&BasisBits}, {&CCResults});
    314314   
    315     mmapK.addKernelDeclarations(mMod);
    316     s2pk.addKernelDeclarations(mMod);
    317     ccck.addKernelDeclarations(mMod);
    318    
    319     iBuilder->SetInsertPoint(BasicBlock::Create(mMod->getContext(), "entry", main,0));
     315    mmapK.addKernelDeclarations(m);
     316    s2pk.addKernelDeclarations(m);
     317    ccck.addKernelDeclarations(m);
     318   
     319    iBuilder->SetInsertPoint(BasicBlock::Create(m->getContext(), "entry", main,0));
    320320
    321321    ByteStream.setStreamSetBuffer(inputStream, fileSize);
     
    327327    iBuilder->CreateRetVoid();
    328328   
    329     Linker L(*mMod);
     329    Linker L(*m);
    330330    L.linkInModule(std::move(mmapM));
    331331    L.linkInModule(std::move(s2pM));
  • icGREP/icgrep-devel/icgrep/editd/editd_cpu_kernel.cpp

    r5285 r5292  
    2323}
    2424
    25 void editdCPUKernel::generateDoBlockMethod(Function * function, Value * self, Value * blockNo) const {
     25void editdCPUKernel::generateDoBlockMethod(Value * blockNo) {
    2626    auto savePoint = iBuilder->saveIP();
    2727
     
    2929    Type * const int8ty = iBuilder->getInt8Ty();
    3030
    31     Value * pattStartPtr = getScalarField(self, "pattStream");
    32     Value * stideCarryArr = getScalarField(self, "srideCarry");
     31    Value * pattStartPtr = getScalarField("pattStream");
     32    Value * stideCarryArr = getScalarField("srideCarry");
    3333
    3434    unsigned carryIdx = 0;
     
    4141    Value * pattCh = iBuilder->CreateLoad(pattPtr);
    4242    Value * pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    43     Value * pattStreamPtr = getStream(self, "CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
     43    Value * pattStreamPtr = getStream("CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
    4444    Value * pattStream = iBuilder->CreateLoad(pattStreamPtr);
    4545    pattPos = iBuilder->CreateAdd(pattPos, ConstantInt::get(int32ty, 1));
     
    5454        pattCh = iBuilder->CreateLoad(pattPtr);
    5555        pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    56         pattStreamPtr = getStream(self, "CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
     56        pattStreamPtr = getStream("CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
    5757        pattStream = iBuilder->CreateLoad(pattStreamPtr);
    5858
     
    7272    }
    7373   
    74     Value * ptr = getStream(self, "ResultStream", blockNo, iBuilder->getInt32(0));
     74    Value * ptr = getStream("ResultStream", blockNo, iBuilder->getInt32(0));
    7575    iBuilder->CreateStore(e[mPatternLen - 1][0], ptr);
    7676    for(unsigned j = 1; j<= mEditDistance; j++){
    77         ptr = getStream(self, "ResultStream", blockNo, iBuilder->getInt32(j));
     77        ptr = getStream("ResultStream", blockNo, iBuilder->getInt32(j));
    7878        iBuilder->CreateStore(iBuilder->CreateAnd(e[mPatternLen-1][j], iBuilder->CreateNot(e[mPatternLen-1][j-1])), ptr);
    7979    }
     
    8383}
    8484
    85 void editdCPUKernel::generateFinalBlockMethod(Function * function, Value * self, Value * remainingBytes, Value * blockNo) const {
    86     setScalarField(self, "EOFmask", iBuilder->bitblock_mask_from(remainingBytes));
    87     iBuilder->CreateCall(getDoBlockFunction(), {self});
     85void editdCPUKernel::generateFinalBlockMethod(Value * remainingBytes, Value * blockNo) {
     86    setScalarField("EOFmask", iBuilder->bitblock_mask_from(remainingBytes));
     87    CreateDoBlockMethodCall();
    8888}
    8989
  • icGREP/icgrep-devel/icgrep/editd/editd_cpu_kernel.h

    r5285 r5292  
    2121   
    2222private:
    23     void generateDoBlockMethod(llvm::Function * function, llvm::Value * self, llvm::Value * blockNo) const override;
    24     void generateFinalBlockMethod(llvm::Function * function, llvm::Value * self, llvm::Value * remainingBytes, llvm::Value * blockNo) const override;
     23    void generateDoBlockMethod(llvm::Value * blockNo) override;
     24    void generateFinalBlockMethod(llvm::Value * remainingBytes, llvm::Value * blockNo) override;
    2525    void bitblock_advance_ci_co(llvm::Value * val, unsigned shift, llvm::Value * stideCarryArr, unsigned carryIdx, std::vector<std::vector<llvm::Value *>> & adv, std::vector<std::vector<int>> & calculated, int i, int j) const;
    2626    unsigned mEditDistance;
  • icGREP/icgrep-devel/icgrep/editd/editd_gpu_kernel.cpp

    r5285 r5292  
    2222}
    2323
    24 void editdGPUKernel::generateDoBlockMethod(Function * function, Value * self, Value * blockNo) const {
     24void editdGPUKernel::generateDoBlockMethod(Value * blockNo) {
    2525
    2626    IntegerType * const int32ty = iBuilder->getInt32Ty();
     
    2828    Value * pattLen = iBuilder->getInt32(mPatternLen + 1);
    2929    Value * pattPos = iBuilder->getInt32(0);
    30     Value * pattBuf = getScalarField(self, "pattStream");
    31     Value * stideCarryArr = getScalarField(self, "srideCarry");
     30    Value * pattBuf = getScalarField("pattStream");
     31    Value * stideCarryArr = getScalarField("srideCarry");
    3232   
    3333    unsigned carryIdx = 0;
     
    4444    Value * pattCh = iBuilder->CreateLoad(pattPtr);
    4545    Value * pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    46     Value * pattStreamPtr = getStream(self, "CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
     46    Value * pattStreamPtr = getStream("CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
    4747    Value * pattStream = iBuilder->CreateLoad(pattStreamPtr);
    4848    pattPos = iBuilder->CreateAdd(pattPos, ConstantInt::get(int32ty, 1));
     
    5656        pattCh = iBuilder->CreateLoad(pattPtr);
    5757        pattIdx = iBuilder->CreateAnd(iBuilder->CreateLShr(pattCh, 1), ConstantInt::get(int8ty, 3));
    58         pattStreamPtr = getStream(self, "CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
     58        pattStreamPtr = getStream("CCStream", blockNo, iBuilder->CreateZExt(pattIdx, int32ty));
    5959        pattStream = iBuilder->CreateLoad(pattStreamPtr);
    6060        bitblock_advance_ci_co(iBuilder, e[i-1][0], 1, stideCarryArr, carryIdx++, adv, calculated, i-1, 0);
     
    7171        pattPos = iBuilder->CreateAdd(pattPos, ConstantInt::get(int32ty, 1));
    7272    }
    73     Value * ptr = getStream(self, "ResultStream", blockNo, iBuilder->getInt32(0));
     73    Value * ptr = getStream("ResultStream", blockNo, iBuilder->getInt32(0));
    7474    iBuilder->CreateStore(e[mPatternLen-1][0], ptr);
    7575    for(unsigned j = 1; j<= mEditDistance; j++){
    76         ptr = getStream(self, "ResultStream", blockNo, iBuilder->getInt32(j));
     76        ptr = getStream("ResultStream", blockNo, iBuilder->getInt32(j));
    7777        iBuilder->CreateStore(iBuilder->CreateAnd(e[mPatternLen - 1][j], iBuilder->CreateNot(e[mPatternLen - 1][j - 1])), ptr);
    7878    }
    7979}
    8080
    81 void editdGPUKernel::generateFinalBlockMethod(Function * function, Value * self, Value * remainingBytes, Value * blockNo) const {
    82     setScalarField(self, "EOFmask", iBuilder->bitblock_mask_from(remainingBytes));
    83     iBuilder->CreateCall(getDoBlockFunction(), { self });
     81void editdGPUKernel::generateFinalBlockMethod(Value * remainingBytes, Value * blockNo) {
     82    setScalarField("EOFmask", iBuilder->bitblock_mask_from(remainingBytes));
     83    CreateDoBlockMethodCall();
    8484}
    8585
  • icGREP/icgrep-devel/icgrep/editd/editd_gpu_kernel.h

    r5285 r5292  
    2121   
    2222private:
    23     void generateDoBlockMethod(llvm::Function * function, llvm::Value * self, llvm::Value * blockNo) const override;
    24     void generateFinalBlockMethod(llvm::Function * function, llvm::Value * self, llvm::Value * remainingBytes, llvm::Value * blockNo) const override;
     23    void generateDoBlockMethod(llvm::Value * blockNo) override;
     24    void generateFinalBlockMethod(llvm::Value * remainingBytes, llvm::Value * blockNo) override;
    2525    unsigned mEditDistance;
    2626    unsigned mPatternLen;
  • icGREP/icgrep-devel/icgrep/editd/editdscan_kernel.cpp

    r5285 r5292  
    1818}
    1919
    20 void editdScanKernel::generateDoBlockMethod(Function * function, Value * self, Value * blockNo) const {
     20void editdScanKernel::generateDoBlockMethod(Value * blockNo) {
    2121    auto savePoint = iBuilder->saveIP();
    2222    Function * scanWordFunction = generateScanWordRoutine(iBuilder->getModule());
     
    3030    std::vector<Value * > matchWordVectors;
    3131    for(unsigned d = 0; d <= mEditDistance; d++) {
    32         Value * ptr = getStream(self, "matchResults", blockNo, iBuilder->getInt32(d));
     32        Value * ptr = getStream("matchResults", blockNo, iBuilder->getInt32(d));
    3333        Value * matches = iBuilder->CreateBlockAlignedLoad(ptr);
    3434        matchWordVectors.push_back(iBuilder->CreateBitCast(matches, scanwordVectorType));
  • icGREP/icgrep-devel/icgrep/editd/editdscan_kernel.h

    r5285 r5292  
    1818       
    1919private:
    20     void generateDoBlockMethod(llvm::Function * function, llvm::Value * self, llvm::Value * blockNo) const override;
     20    void generateDoBlockMethod(llvm::Value * blockNo) override;
    2121    llvm::Function * generateScanWordRoutine(llvm::Module * m) const;
    2222       
Note: See TracChangeset for help on using the changeset viewer.