Changeset 5733


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

Changes for compatibility with LLVM 5.0.0

Location:
icGREP/icgrep-devel/icgrep
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r5731 r5733  
    4444# Let's suppose we want to build a JIT compiler with support for
    4545# binary code (no interpreter):
    46 set(LLVM_ALL_TARGETS AArch64 AMDGPU ARM BPF CppBackend Hexagon Mips MSP430 NVPTX PowerPC Sparc SystemZ X86 XCore)
     46set(LLVM_ALL_TARGETS X86)
    4747llvm_map_components_to_libnames(REQ_LLVM_LIBRARIES ${LLVM_ALL_TARGETS} mcjit native IRReader Linker)
    4848
  • 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}
  • icGREP/icgrep-devel/icgrep/kernels/interface.cpp

    r5706 r5733  
    3131    PointerType * const selfType = mKernelStateType->getPointerTo();
    3232    IntegerType * const sizeTy = idb->getSizeTy();
    33     PointerType * const consumerTy = StructType::get(sizeTy, sizeTy->getPointerTo()->getPointerTo(), nullptr)->getPointerTo();
     33    PointerType * const consumerTy = StructType::get(idb->getContext(), {sizeTy, sizeTy->getPointerTo()->getPointerTo()})->getPointerTo();
    3434    Type * const voidTy = idb->getVoidTy();
    3535
     
    6464    doSegment->setCallingConv(CallingConv::C);
    6565    doSegment->setDoesNotThrow();
    66     doSegment->setDoesNotCapture(1); // for self parameter only.
    6766    args = doSegment->arg_begin();
    6867    args->setName("self");
     
    9897    terminateFunc->setCallingConv(CallingConv::C);
    9998    terminateFunc->setDoesNotThrow();
    100     terminateFunc->setDoesNotCapture(1);
    10199    args = terminateFunc->arg_begin();
    102100    args->setName("self");
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5732 r5733  
    297297        addScalar(binding.getType(), binding.getName());
    298298    }
    299     Type * const consumerSetTy = StructType::get(sizeTy, sizeTy->getPointerTo()->getPointerTo(), nullptr)->getPointerTo();
     299    Type * const consumerSetTy = StructType::get(idb->getContext(), {sizeTy, sizeTy->getPointerTo()->getPointerTo()})->getPointerTo();
    300300    for (unsigned i = 0; i < mStreamSetOutputs.size(); i++) {
    301301        addScalar(consumerSetTy, mStreamSetOutputs[i].getName() + CONSUMER_SUFFIX);
     
    527527    PointerType * const sizePtrTy = sizeTy->getPointerTo();
    528528    PointerType * const sizePtrPtrTy = sizePtrTy->getPointerTo();
    529     StructType * const consumerTy = StructType::get(sizeTy, sizePtrPtrTy, nullptr);
     529    StructType * const consumerTy = StructType::get(idb->getContext(), {sizeTy, sizePtrPtrTy});
    530530    for (unsigned i = 0; i < mStreamSetOutputBuffers.size(); ++i) {
    531531        const auto output = mStreamSetOutputBuffers[i];
     
    13311331        mCurrentMethod->setCallingConv(CallingConv::C);
    13321332        mCurrentMethod->setDoesNotThrow();
    1333         mCurrentMethod->setDoesNotCapture(1);
    13341333        auto args = mCurrentMethod->arg_begin();
    13351334        args->setName("self");
     
    13791378        mCurrentMethod->setCallingConv(CallingConv::C);
    13801379        mCurrentMethod->setDoesNotThrow();
    1381         mCurrentMethod->setDoesNotCapture(1);
    13821380        auto args = mCurrentMethod->arg_begin();
    13831381        args->setName("self");
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5721 r5733  
    812812
    813813SourceBuffer::SourceBuffer(const std::unique_ptr<kernel::KernelBuilder> & b, Type * type, unsigned MemoryAddressSpace, unsigned StructAddressSpace)
    814 : StreamSetBuffer(BufferKind::SourceBuffer, type, StructType::get(resolveStreamSetType(b, type)->getPointerTo(MemoryAddressSpace), b->getSizeTy(), b->getSizeTy(), nullptr), 0, StructAddressSpace) {
     814: StreamSetBuffer(BufferKind::SourceBuffer, type, StructType::get(b->getContext(), {resolveStreamSetType(b, type)->getPointerTo(MemoryAddressSpace), b->getSizeTy(), b->getSizeTy()}), 0, StructAddressSpace) {
    815815    mUniqueID = "B";
    816816    if (MemoryAddressSpace != 0 || StructAddressSpace != 0) {
     
    872872    IntegerType * sizeTy = b->getSizeTy();
    873873    PointerType * typePtr = baseType->getPointerTo(addrSpace);
    874     return StructType::get(typePtr, typePtr, sizeTy, sizeTy, sizeTy, sizeTy, sizeTy, nullptr);
     874    return StructType::get(b->getContext(), {typePtr, typePtr, sizeTy, sizeTy, sizeTy, sizeTy, sizeTy});
    875875}
    876876
     
    947947                type = ArrayType::get(type, fieldWidth);
    948948            }
    949             return StructType::get(b->getSizeTy(), type->getPointerTo(), nullptr);
     949            return StructType::get(b->getContext(), {b->getSizeTy(), type->getPointerTo()});
    950950        }
    951951    }
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r5721 r5733  
    10351035        if (LLVM_UNLIKELY(nonCarryCollapsingMode)) {
    10361036            mHasNonCarryCollapsingLoops = true;
    1037             carryState = StructType::get(b->getSizeTy(), carryState->getPointerTo(), carryTy->getPointerTo(), nullptr);
     1037            carryState = StructType::get(b->getContext(), {b->getSizeTy(), carryState->getPointerTo(), carryTy->getPointerTo()});
    10381038            assert (isDynamicallyAllocatedType(carryState));
    10391039        }
  • icGREP/icgrep-devel/icgrep/pablo/carrypack_manager.cpp

    r5721 r5733  
    11881188        if (LLVM_UNLIKELY(nonCarryCollapsingMode)) {
    11891189            mHasNonCarryCollapsingLoops = true;
    1190             carryState = StructType::get(iBuilder->getSizeTy(), carryState->getPointerTo(), carryTy->getPointerTo(), nullptr);
     1190            carryState = StructType::get(iBuilder->getContext(), {iBuilder->getSizeTy(), carryState->getPointerTo(), carryTy->getPointerTo()};
    11911191            assert (isDynamicallyAllocatedType(carryState));
    11921192        }
  • icGREP/icgrep-devel/icgrep/toolchain/cpudriver.cpp

    r5731 r5733  
    1111#include <llvm/Support/Compiler.h>                 // for LLVM_UNLIKELY
    1212#include <llvm/Support/TargetSelect.h>
     13#include <llvm/Support/FileSystem.h>
    1314#include <llvm/Target/TargetMachine.h>             // for TargetMachine, Tar...
    1415#include <llvm/Target/TargetOptions.h>             // for TargetOptions
  • icGREP/icgrep-devel/icgrep/toolchain/pipeline.cpp

    r5721 r5733  
    6060    }
    6161    StructType * const sharedStructType = StructType::get(m->getContext(), structTypes);
    62     StructType * const threadStructType = StructType::get(sharedStructType->getPointerTo(), sizeTy, nullptr);
     62    StructType * const threadStructType = StructType::get(m->getContext(), {sharedStructType->getPointerTo(), sizeTy});
    6363
    6464    Function * const threadFunc = makeThreadFunction(iBuilder, "segment");
     65    Function::arg_iterator args = threadFunc->arg_begin();
     66    Value * threadStruct = iBuilder->CreateBitCast(&*(args), threadStructType->getPointerTo());
    6567
    6668    // -------------------------------------------------------------------------------------------------------------------------
     
    7274    BasicBlock * entryBlock = BasicBlock::Create(iBuilder->getContext(), "entry", threadFunc);
    7375    iBuilder->SetInsertPoint(entryBlock);
    74     Value * const input = &threadFunc->getArgumentList().front();
    75     Value * const threadStruct = iBuilder->CreatePointerCast(input, threadStructType->getPointerTo());
    7676    Value * const sharedStatePtr = iBuilder->CreateLoad(iBuilder->CreateGEP(threadStruct, {iBuilder->getInt32(0), iBuilder->getInt32(0)}));
    7777    for (unsigned k = 0; k < n; ++k) {
     
    383383
    384384        Function * const threadFunc = makeThreadFunction(iBuilder, "ppt:" + kernel->getName());
    385 
     385        Function::arg_iterator ai = threadFunc->arg_begin();
     386        Value * sharedStruct = iBuilder->CreateBitCast(&*(ai), sharedStructType->getPointerTo());
     387       
    386388         // Create the basic blocks for the thread function.
    387389        BasicBlock * entryBlock = BasicBlock::Create(iBuilder->getContext(), "entry", threadFunc);
     
    393395        iBuilder->SetInsertPoint(entryBlock);
    394396
    395         Value * sharedStruct = iBuilder->CreateBitCast(&threadFunc->getArgumentList().front(), sharedStructType->getPointerTo());
    396397
    397398        for (unsigned k = 0; k < n; k++) {
Note: See TracChangeset for help on using the changeset viewer.