Ignore:
Timestamp:
Nov 2, 2017, 10:22:06 AM (21 months ago)
Author:
cameron
Message:

EnableAsserts? and EnableCycleCounter? are DebugOptions? (disable object caching)

File:
1 edited

Legend:

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

    r5706 r5721  
    340340    size = CreateZExtOrTrunc(size, sizeTy);
    341341    ConstantInt * const align = ConstantInt::get(sizeTy, alignment);
    342     if (codegen::EnableAsserts) {
     342    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    343343        CreateAssertZero(CreateURem(size, align), "CreateAlignedMalloc: size must be an integral multiple of alignment.");
    344344    }
     
    364364        Value * handle = CreateAlloca(voidPtrTy);
    365365        CallInst * success = CreateCall(f, {handle, align, size});
    366         if (codegen::EnableAsserts) {
     366        if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    367367            CreateAssertZero(success, "CreateAlignedMalloc: posix_memalign reported bad allocation");
    368368        }
     
    448448    }
    449449    Value * ptr = CreateCall(fMMap, {addr, size, prot, flags, fd, offset});
    450     if (codegen::EnableAsserts) {
     450    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    451451        DataLayout DL(m);
    452452        IntegerType * const intTy = getIntPtrTy(DL);
     
    538538        ConstantInt * const flags = ConstantInt::get(intTy, MREMAP_MAYMOVE);
    539539        ptr = CreateCall(fMRemap, {addr, oldSize, newSize, flags});
    540         if (codegen::EnableAsserts) {
     540        if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    541541            Value * success = CreateICmpNE(CreatePtrToInt(addr, intTy), ConstantInt::getAllOnesValue(intTy)); // MAP_FAILED = -1
    542542            CreateAssert(success, "CreateMRemap: mremap failed to allocate memory");
     
    560560    }
    561561    len = CreateZExtOrTrunc(len, sizeTy);
    562     if (codegen::EnableAsserts) {
     562    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    563563        DataLayout DL(getModule());
    564564        IntegerType * const intPtrTy = getIntPtrTy(DL);
     
    858858
    859859void CBuilder::__CreateAssert(Value * const assertion, StringRef failureMessage) {
    860     if (LLVM_UNLIKELY(codegen::EnableAsserts)) {
     860    if (LLVM_UNLIKELY(codegen::DebugOptionIsSet(codegen::EnableAsserts))) {
    861861        Module * const m = getModule();
    862862        if (LLVM_UNLIKELY(isa<ConstantInt>(assertion))) {
     
    11151115
    11161116#define CHECK_ADDRESS(Ptr, Name) \
    1117 if (codegen::EnableAsserts) { \
     1117if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) { \
    11181118    CreateAssert(Ptr, Name " was given a null address"); \
    11191119    if (AllocaInst * Base = resolveStackAddress(Ptr)) { \
     
    11511151
    11521152inline bool CBuilder::hasAddressSanitizer() const {
    1153     return codegen::EnableAsserts && mDriver && mDriver->hasExternalFunction("__asan_region_is_poisoned");
     1153    return codegen::DebugOptionIsSet(codegen::EnableAsserts) && mDriver && mDriver->hasExternalFunction("__asan_region_is_poisoned");
    11541154}
    11551155
    11561156LoadInst * CBuilder::CreateAlignedLoad(Value * Ptr, unsigned Align, const char * Name) {
    1157     if (codegen::EnableAsserts) {
     1157    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    11581158        DataLayout DL(getModule());
    11591159        IntegerType * const intPtrTy = cast<IntegerType>(DL.getIntPtrType(Ptr->getType()));
     
    11671167
    11681168LoadInst * CBuilder::CreateAlignedLoad(Value * Ptr, unsigned Align, const Twine & Name) {
    1169     if (codegen::EnableAsserts) {
     1169    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    11701170        DataLayout DL(getModule());
    11711171        IntegerType * const intPtrTy = cast<IntegerType>(DL.getIntPtrType(Ptr->getType()));
     
    11791179
    11801180LoadInst * CBuilder::CreateAlignedLoad(Value * Ptr, unsigned Align, bool isVolatile, const Twine & Name) {
    1181     if (codegen::EnableAsserts) {
     1181    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    11821182        DataLayout DL(getModule());
    11831183        IntegerType * const intPtrTy = cast<IntegerType>(DL.getIntPtrType(Ptr->getType()));
     
    11911191
    11921192StoreInst * CBuilder::CreateAlignedStore(Value * Val, Value * Ptr, unsigned Align, bool isVolatile) {
    1193     if (codegen::EnableAsserts) {
     1193    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    11941194        DataLayout DL(getModule());
    11951195        IntegerType * const intPtrTy = cast<IntegerType>(DL.getIntPtrType(Ptr->getType()));
     
    12041204CallInst * CBuilder::CreateMemMove(Value * Dst, Value * Src, Value *Size, unsigned Align, bool isVolatile,
    12051205                                   MDNode *TBAATag, MDNode *ScopeTag, MDNode *NoAliasTag) {
    1206     if (codegen::EnableAsserts) {
     1206    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    12071207        DataLayout DL(getModule());
    12081208        IntegerType * const intPtrTy = DL.getIntPtrType(getContext());
     
    12221222CallInst * CBuilder::CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile,
    12231223                                  MDNode *TBAATag, MDNode *TBAAStructTag, MDNode *ScopeTag, MDNode *NoAliasTag) {
    1224     if (codegen::EnableAsserts) {
     1224    if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    12251225        DataLayout DL(getModule());
    12261226        IntegerType * const intPtrTy = DL.getIntPtrType(getContext());
Note: See TracChangeset for help on using the changeset viewer.