Changeset 5988 for icGREP


Ignore:
Timestamp:
Apr 25, 2018, 12:14:44 PM (13 months ago)
Author:
cameron
Message:

CreateMemChr?

Location:
icGREP/icgrep-devel/icgrep/IR_Gen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.cpp

    r5985 r5988  
    12911291}
    12921292
     1293Value * CBuilder::CreateMemChr(llvm::Value * ptr, llvm::Value * byteVal, llvm::Value * num) {
     1294    Module * const m = getModule();
     1295    Function * memchrFn = m->getFunction("memchr");
     1296    if (memchrFn == nullptr) {
     1297        IntegerType * const int32Ty = getInt32Ty();
     1298        IntegerType * const sizeTy = getSizeTy();
     1299        PointerType * const voidPtrTy = getVoidPtrTy();
     1300        memchrFn = cast<Function>(m->getOrInsertFunction("memchr",
     1301                                                         voidPtrTy, voidPtrTy, int32Ty, sizeTy, nullptr));
     1302    }
     1303    return CreateCall(memchrFn, {ptr, byteVal, num});
     1304}
     1305
    12931306CallInst * CBuilder::CreateMemMove(Value * Dst, Value * Src, Value *Size, unsigned Align, bool isVolatile,
    12941307                                   MDNode *TBAATag, MDNode *ScopeTag, MDNode *NoAliasTag) {
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.h

    r5985 r5988  
    112112    }
    113113
     114    llvm::Value * CreateMemChr(llvm::Value * ptr, llvm::Value * byteVal, llvm::Value * num);
     115   
    114116    llvm::AllocaInst * CreateAlignedAlloca(llvm::Type * const Ty, const unsigned alignment, llvm::Value * const ArraySize = nullptr) {
    115117        llvm::AllocaInst * instr = CreateAlloca(Ty, ArraySize);
Note: See TracChangeset for help on using the changeset viewer.