Ignore:
Timestamp:
Nov 11, 2017, 9:46:13 PM (18 months ago)
Author:
cameron
Message:

Changes for compatibility with LLVM 5.0.0

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

Legend:

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

    r5721 r5733  
    4040#endif
    4141
     42
     43#if LLVM_VERSION_INTEGER < LLVM_5_0_0
     44#define setReturnDoesNotAlias() setDoesNotAlias(0)
     45#endif
     46
     47
    4248using namespace llvm;
    4349
     
    126132        IntegerType * int32Ty = getInt32Ty();
    127133        write = cast<Function>(m->getOrInsertFunction("write",
     134#if LLVM_VERSION_INTEGER < LLVM_5_0_0
    128135                                                        AttributeSet().addAttribute(getContext(), 2U, Attribute::NoAlias),
     136#else
     137                                                        AttributeList().addAttribute(getContext(), 2U, Attribute::NoAlias),
     138#endif
    129139                                                        sizeTy, int32Ty, voidPtrTy, sizeTy, nullptr));
    130140    }
     
    141151        IntegerType * int32Ty = getInt32Ty();
    142152        readFn = cast<Function>(m->getOrInsertFunction("read",
     153#if LLVM_VERSION_INTEGER < LLVM_5_0_0
    143154                                                         AttributeSet().addAttribute(getContext(), 2U, Attribute::NoAlias),
     155#else
     156                                                         AttributeList().addAttribute(getContext(), 2U, Attribute::NoAlias),
     157#endif
    144158                                                         sizeTy, int32Ty, voidPtrTy, sizeTy, nullptr));
    145159    }
     
    310324        f = Function::Create(fty, Function::ExternalLinkage, "malloc", m);
    311325        f->setCallingConv(CallingConv::C);
    312         f->setDoesNotAlias(0);
     326        f->setReturnDoesNotAlias();
    313327    }
    314328    size = CreateZExtOrTrunc(size, sizeTy);
     
    350364            f = Function::Create(fty, Function::ExternalLinkage, "aligned_alloc", m);
    351365            f->setCallingConv(CallingConv::C);
    352             f->setDoesNotAlias(0);
     366            f->setReturnDoesNotAlias();
    353367        }
    354368        ptr = CreateCall(f, {align, size});
     
    359373            f = Function::Create(fty, Function::ExternalLinkage, "posix_memalign", m);
    360374            f->setCallingConv(CallingConv::C);
    361             f->setDoesNotAlias(0);
     375            f->setReturnDoesNotAlias();
     376#if LLVM_VERSION_INTEGER < LLVM_5_0_0
    362377            f->setDoesNotAlias(1);
     378#endif
    363379        }
    364380        Value * handle = CreateAlloca(voidPtrTy);
     
    393409        f = Function::Create(fty, Function::ExternalLinkage, "realloc", m);
    394410        f->setCallingConv(CallingConv::C);
    395         f->setDoesNotAlias(0);
     411        f->setReturnDoesNotAlias();
     412#if LLVM_VERSION_INTEGER < LLVM_5_0_0
    396413        f->setDoesNotAlias(1);
     414#endif
    397415    }
    398416    CallInst * const ci = CreateCall(f, {CreatePointerCast(ptr, voidPtrTy), CreateZExtOrTrunc(size, sizeTy)});
     
    877895            function = Function::Create(fty, Function::PrivateLinkage, "assert", m);
    878896            function->setDoesNotThrow();
     897#if LLVM_VERSION_INTEGER < LLVM_5_0_0
    879898            function->setDoesNotAlias(2);
     899#endif
    880900            BasicBlock * const entry = BasicBlock::Create(getContext(), "", function);
    881901            BasicBlock * const failure = BasicBlock::Create(getContext(), "", function);
     
    10771097        isPoisoned = Function::Create(FunctionType::get(voidPtrTy, {voidPtrTy, sizeTy}, false), Function::ExternalLinkage, "__asan_region_is_poisoned", m);
    10781098        isPoisoned->setCallingConv(CallingConv::C);
    1079         isPoisoned->setDoesNotAlias(0);
     1099        isPoisoned->setReturnDoesNotAlias();
    10801100        isPoisoned->setDoesNotAlias(1);
    10811101    } \
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_nvptx_builder.cpp

    r5630 r5733  
    44 *  icgrep is a trademark of International Characters.
    55 */
    6 
     6#include <toolchain/toolchain.h>
    77#include "idisa_nvptx_builder.h"
    88#include <llvm/IR/InlineAsm.h>
     
    263263    InlineAsm *IA = InlineAsm::get(AsmFnTy, AsmStream, "=r,r", true, false);
    264264    CallInst * result = CreateCall(IA, conv);
     265#if LLVM_VERSION_INTEGER < LLVM_5_0_0
    265266    result->addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind);
    266 
     267#else
     268    result->addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind);
     269#endif
    267270    CreateRet(result);
    268271}
Note: See TracChangeset for help on using the changeset viewer.