Ignore:
Timestamp:
Jun 6, 2017, 6:20:55 PM (2 years ago)
Author:
cameron
Message:

Restore check-ins from the last several days

File:
1 edited

Legend:

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

    r5489 r5493  
    2525
    2626class CBuilder : public llvm::IRBuilder<> {
     27    using Predicate = llvm::CmpInst::Predicate;
    2728public:
    2829
     
    177178    virtual llvm::StoreInst *  CreateAtomicStoreRelease(llvm::Value * val, llvm::Value * ptr);
    178179
    179     void CreateAssert(llvm::Value * assertion, llvm::StringRef failureMessage);
     180    void CreateAssert(llvm::Value * assertion, llvm::StringRef failureMessage) {
     181        if (LLVM_UNLIKELY(assertion->getType()->isVectorTy())) {
     182            assertion = CreateBitCast(assertion, llvm::IntegerType::get(getContext(), assertion->getType()->getPrimitiveSizeInBits()));
     183        }
     184        return __CreateAssert(CreateICmpNE(assertion, llvm::Constant::getNullValue(assertion->getType())), failureMessage);
     185    }
     186
     187    void CreateAssertZero(llvm::Value * assertion, llvm::StringRef failureMessage) {
     188        if (LLVM_UNLIKELY(assertion->getType()->isVectorTy())) {
     189            assertion = CreateBitCast(assertion, llvm::IntegerType::get(getContext(), assertion->getType()->getPrimitiveSizeInBits()));
     190        }
     191        return __CreateAssert(CreateICmpEQ(assertion, llvm::Constant::getNullValue(assertion->getType())), failureMessage);
     192    }
    180193
    181194    void CreateExit(const int exitCode);
     
    218231
    219232    #ifdef HAS_ADDRESS_SANITIZER
    220     virtual llvm::LoadInst * CreateLoad(llvm::Value *Ptr, const char *Name);
    221 
    222     virtual llvm::LoadInst * CreateLoad(llvm::Value *Ptr, const llvm::Twine &Name = "");
    223 
    224     virtual llvm::LoadInst * CreateLoad(llvm::Type *Ty, llvm::Value *Ptr, const llvm::Twine &Name = "");
    225 
    226     virtual llvm::LoadInst * CreateLoad(llvm::Value *Ptr, bool isVolatile, const llvm::Twine &Name = "");
    227 
    228     virtual llvm::StoreInst * CreateStore(llvm::Value *Val, llvm::Value *Ptr, bool isVolatile = false);
    229 
    230     llvm::LoadInst * CreateAlignedLoad(llvm::Value *Ptr, unsigned Align, const char *Name) {
    231         llvm::LoadInst * LI = CreateLoad(Ptr, Name);
    232         LI->setAlignment(Align);
    233         return LI;
    234     }
    235 
    236     llvm::LoadInst * CreateAlignedLoad(llvm::Value *Ptr, unsigned Align, const llvm::Twine &Name = "") {
    237         llvm::LoadInst * LI = CreateLoad(Ptr, Name);
    238         LI->setAlignment(Align);
    239         return LI;
    240     }
    241 
    242     llvm::LoadInst * CreateAlignedLoad(llvm::Value *Ptr, unsigned Align, bool isVolatile, const llvm::Twine &Name = "") {
    243         llvm::LoadInst * LI = CreateLoad(Ptr, isVolatile, Name);
    244         LI->setAlignment(Align);
    245         return LI;
    246     }
    247 
    248     llvm::StoreInst * CreateAlignedStore(llvm::Value *Val, llvm::Value *Ptr, unsigned Align, bool isVolatile = false) {
    249         llvm::StoreInst *SI = CreateStore(Val, Ptr, isVolatile);
    250         SI->setAlignment(Align);
    251         return SI;
    252     }
     233    virtual llvm::LoadInst * CreateLoad(llvm::Value * Ptr, const char * Name);
     234
     235    virtual llvm::LoadInst * CreateLoad(llvm::Value * Ptr, const llvm::Twine & Name = "");
     236
     237    virtual llvm::LoadInst * CreateLoad(llvm::Type * Ty, llvm::Value * Ptr, const llvm::Twine & Name = "");
     238
     239    virtual llvm::LoadInst * CreateLoad(llvm::Value * Ptr, bool isVolatile, const llvm::Twine & Name = "");
     240
     241    virtual llvm::StoreInst * CreateStore(llvm::Value * Val, llvm::Value * Ptr, bool isVolatile = false);
    253242    #endif
     243
     244    llvm::LoadInst * CreateAlignedLoad(llvm::Value * Ptr, unsigned Align, const char * Name);
     245
     246    llvm::LoadInst * CreateAlignedLoad(llvm::Value * Ptr, unsigned Align, const llvm::Twine & Name = "");
     247
     248    llvm::LoadInst * CreateAlignedLoad(llvm::Value * Ptr, unsigned Align, bool isVolatile, const llvm::Twine & Name = "");
     249
     250    llvm::StoreInst * CreateAlignedStore(llvm::Value * Val, llvm::Value * Ptr, unsigned Align, bool isVolatile = false);
    254251
    255252    void setDriver(Driver * const driver) {
     
    258255
    259256protected:
     257
     258    bool hasAlignedAlloc() const;
     259
     260    bool hasPosixMemalign() const;
     261
     262    bool hasAddressSanitizer() const;
     263
     264    void __CreateAssert(llvm::Value * assertion, llvm::StringRef failureMessage);
    260265
    261266    llvm::Function * LinkFunction(llvm::StringRef name, llvm::FunctionType * type, void * functionPtr) const;
     
    267272    llvm::IntegerType * const       mSizeType;
    268273    llvm::StructType *              mFILEtype;
    269     Driver *                        mDriver;
     274    Driver *                        mDriver;   
    270275    llvm::LLVMContext               mContext;
    271276    const std::string               mTriple;
Note: See TracChangeset for help on using the changeset viewer.